Class: GroongaQueryLog::Command::CheckPerformanceRegression::QueryStatistic
- Inherits:
-
Statistic
- Object
- Statistic
- GroongaQueryLog::Command::CheckPerformanceRegression::QueryStatistic
- Defined in:
- lib/groonga-query-log/command/check-performance-regression.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(query, old, new, threshold) ⇒ QueryStatistic
constructor
A new instance of QueryStatistic.
- #operation_sets ⇒ Object
- #slow? ⇒ Boolean
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.
290 291 292 293 |
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 290 def initialize(query, old, new, threshold) super(old, new, threshold) @query = query end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
289 290 291 |
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 289 def query @query end |
Instance Method Details
#operation_sets ⇒ Object
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 299 def operation_sets old_operation_name_sets = @old.group_by do |statistic| statistic.operations.collect do |operation| operation[:name] end end new_operation_name_sets = @new.group_by do |statistic| statistic.operations.collect do |operation| operation[:name] end end operation_sets = [] operation_name_sets = (old_operation_name_sets.keys & new_operation_name_sets.keys) operation_name_sets.each do |operation_names| old = old_operation_name_sets[operation_names] next if old.nil? new = new_operation_name_sets[operation_names] next if new.nil? statistics = operation_names.size.times.collect do |i| old_operations = old.collect do |statistic| statistic.operations[i] end new_operations = new.collect do |statistic| statistic.operations[i] end operation = old_operations[0] OperationStatistic.new(operation, i, old_operations, new_operations, @threshold) end operation_set = OperationSet.new(operation_names, statistics) operation_sets << operation_set end operation_sets end |
#slow? ⇒ Boolean
295 296 297 |
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 295 def slow? @threshold.slow_query?(diff_elapsed_time, ratio) end |