Class: GroongaQueryLog::PerformanceVerifier

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-query-log/performance-verifier.rb

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Constructor Details

#initialize(command, old_responses, new_responses, options) ⇒ PerformanceVerifier

Returns a new instance of PerformanceVerifier.



29
30
31
32
33
34
35
36
# File 'lib/groonga-query-log/performance-verifier.rb', line 29

def initialize(command, old_responses, new_responses, options)
  @command = command
  @old_responses = old_responses
  @new_responses = new_responses
  @options = options
  @threshold_diff = 0.1
  @threshold_ratio = 1.1
end

Instance Method Details

#diff_ratioObject



66
67
68
# File 'lib/groonga-query-log/performance-verifier.rb', line 66

def diff_ratio
  compute_diff_ratio
end

#new_elapsed_timeObject



62
63
64
# File 'lib/groonga-query-log/performance-verifier.rb', line 62

def new_elapsed_time
  choose_target_elapsed_time(@new_responses)
end

#new_elapsed_timesObject



58
59
60
# File 'lib/groonga-query-log/performance-verifier.rb', line 58

def new_elapsed_times
  collect_elapsed_times(@new_responses)
end

#old_elapsed_timeObject



54
55
56
# File 'lib/groonga-query-log/performance-verifier.rb', line 54

def old_elapsed_time
  choose_target_elapsed_time(@old_responses)
end

#old_elapsed_timesObject



50
51
52
# File 'lib/groonga-query-log/performance-verifier.rb', line 50

def old_elapsed_times
  collect_elapsed_times(@old_responses)
end

#slow?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
43
44
45
46
47
48
# File 'lib/groonga-query-log/performance-verifier.rb', line 38

def slow?
  if error?(@old_responses) or error?(@new_responses)
    return false
  end

  if (old_elapsed_time - new_elapsed_time).abs < @threshold_diff
    return false
  end

  diff_ratio > @threshold_ratio
end