Class: PigCI::Profiler::RequestTime

Inherits:
PigCI::Profiler show all
Defined in:
lib/pig_ci/profiler/request_time.rb

Instance Attribute Summary collapse

Attributes inherited from PigCI::Profiler

#historical_log_file, #i18n_key, #log_file

Instance Method Summary collapse

Methods inherited from PigCI::Profiler

#increment!, #initialize, #save!, #setup!

Constructor Details

This class inherits a constructor from PigCI::Profiler

Instance Attribute Details

#end_timeObject

Returns the value of attribute end_time


2
3
4
# File 'lib/pig_ci/profiler/request_time.rb', line 2

def end_time
  @end_time
end

#start_timeObject

Returns the value of attribute start_time


2
3
4
# File 'lib/pig_ci/profiler/request_time.rb', line 2

def start_time
  @start_time
end

Instance Method Details

#log_request!(request_key) ⇒ Object


9
10
11
12
# File 'lib/pig_ci/profiler/request_time.rb', line 9

def log_request!(request_key)
  @end_time = Time.now.utc
  super
end

#log_valueObject


14
15
16
# File 'lib/pig_ci/profiler/request_time.rb', line 14

def log_value
  (@end_time - @start_time) * 1000.0
end

#reset!Object


4
5
6
7
# File 'lib/pig_ci/profiler/request_time.rb', line 4

def reset!
  super
  @start_time = Time.now.utc
end