Class: Familia::Validation::PerformanceAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/familia/validation/validator.rb

Overview

Analyzes performance characteristics of recorded commands

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_sequence) ⇒ PerformanceAnalyzer

Returns a new instance of PerformanceAnalyzer.



300
301
302
# File 'lib/familia/validation/validator.rb', line 300

def initialize(command_sequence)
  @command_sequence = command_sequence
end

Instance Attribute Details

#command_sequenceObject (readonly)

Returns the value of attribute command_sequence.



298
299
300
# File 'lib/familia/validation/validator.rb', line 298

def command_sequence
  @command_sequence
end

Instance Method Details

#analyzeObject



304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/familia/validation/validator.rb', line 304

def analyze
  {
    total_commands: @command_sequence.command_count,
    total_duration_ms: total_duration_ms,
    average_command_time_us: average_command_time,
    slowest_commands: slowest_commands(5),
    command_type_breakdown: command_type_breakdown,
    transaction_efficiency: transaction_efficiency,
    potential_n_plus_one: detect_n_plus_one_patterns,
    efficiency_score: calculate_efficiency_score
  }
end