Class: GroongaQueryLog::Command::CheckPerformanceRegression::Threshold

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeThreshold

Returns a new instance of Threshold.



193
194
195
196
197
198
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 193

def initialize
  @query_ratio = 0
  @query_second = 0.2
  @operation_ratio = 0.1
  @operation_second = 0.1
end

Instance Attribute Details

#operation_ratioObject

Returns the value of attribute operation_ratio.



191
192
193
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 191

def operation_ratio
  @operation_ratio
end

#operation_secondObject

Returns the value of attribute operation_second.



192
193
194
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 192

def operation_second
  @operation_second
end

#query_ratioObject

Returns the value of attribute query_ratio.



189
190
191
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 189

def query_ratio
  @query_ratio
end

#query_secondObject

Returns the value of attribute query_second.



190
191
192
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 190

def query_second
  @query_second
end

Instance Method Details

#slow_operation?(diff_sec, diff_ratio) ⇒ Boolean

Returns:

  • (Boolean)


206
207
208
209
210
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 206

def slow_operation?(diff_sec, diff_ratio)
  return false if diff_sec.zero?
  (diff_sec >= @operation_second) and
    (diff_ratio >= @operation_ratio)
end

#slow_query?(diff_sec, diff_ratio) ⇒ Boolean

Returns:

  • (Boolean)


200
201
202
203
204
# File 'lib/groonga-query-log/command/check-performance-regression.rb', line 200

def slow_query?(diff_sec, diff_ratio)
  return false if diff_sec.zero?
  (diff_sec >= @query_second) and
    (diff_ratio >= @query_ratio)
end