Class: GroongaQueryLog::Command::CheckPerformanceRegression::QueryStatistic

Inherits:
Statistic
  • Object
show all
Defined in:
lib/groonga-query-log/command/check-performance-regression.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Statistic

#diff_elapsed_time, #new_elapsed_time, #old_elapsed_time, #ratio

Constructor Details

#initialize(query, old, new, threshold) ⇒ QueryStatistic

Returns a new instance of QueryStatistic.



282
283
284
285
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 282

def initialize(query, old, new, threshold)
  super(old, new, threshold)
  @query = query
end

Instance Attribute Details

#queryObject (readonly)

Returns the value of attribute query.



281
282
283
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 281

def query
  @query
end

Instance Method Details

#each_operation_statisticObject



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 291

def each_operation_statistic
  @old.first.operations.each_with_index do |operation, i|
    old_operations = @old.collect do |statistic|
      statistic.operations[i]
    end
    # TODO: old and new may use different index
    new_operations = @new.collect do |statistic|
      statistic.operations[i]
    end
    operation_statistic = OperationStatistic.new(operation,
                                                 i,
                                                 old_operations,
                                                 new_operations,
                                                 @threshold)
    yield(operation_statistic)
  end
end

#slow?Boolean

Returns:

  • (Boolean)


287
288
289
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 287

def slow?
  @threshold.slow_query?(diff_elapsed_time, ratio)
end