Module: DiyProf::TimeHelpers

Included in:
Tracer
Defined in:
lib/diy_prof/lib/diy_prof/time_helpers.rb

Instance Method Summary collapse

Instance Method Details

#cpu_timeObject

These methods make use of ‘clock_gettime` method introduced in Ruby 2.1 to measure CPU time and Wall clock time.



5
6
7
# File 'lib/diy_prof/lib/diy_prof/time_helpers.rb', line 5

def cpu_time
  Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :microsecond)
end

#wall_timeObject



9
10
11
# File 'lib/diy_prof/lib/diy_prof/time_helpers.rb', line 9

def wall_time
  Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond)
end