class GroongaQueryLog::Command::CheckPerformanceRegression::OperationStatistic

Attributes

index[R]

Public Class Methods

new(operation, index, old, new, threshold) click to toggle source
# File lib/groonga-query-log/command/check-performance-regression.rb, line 252
def initialize(operation, index, old, new, threshold)
  super(old, new, threshold)
  @operation = operation
  @index = index
end

Public Instance Methods

context() click to toggle source
# File lib/groonga-query-log/command/check-performance-regression.rb, line 262
def context
  @operation[:context]
end
name() click to toggle source
# File lib/groonga-query-log/command/check-performance-regression.rb, line 258
def name
  @operation[:name]
end
slow?() click to toggle source
# File lib/groonga-query-log/command/check-performance-regression.rb, line 266
def slow?
  @threshold.slow_operation?(diff_elapsed_time, ratio)
end

Private Instance Methods

compute_mean(operations) click to toggle source
# File lib/groonga-query-log/command/check-performance-regression.rb, line 271
def compute_mean(operations)
  elapsed_times = operations.collect do |operation|
    operation[:relative_elapsed] / 1000.0 / 1000.0 / 1000.0
  end
  elapsed_times.inject(:+) / elapsed_times.size
end