module Hitimes
The top level module containing the contents of the hitimes library
use the library with:
require 'hitimes'
Copyright © 2008 Jeremy Hinegardner All rights reserved. See LICENSE and/or COPYING for details.
Constants
- MutexedStats
MutexedStats is the start of a threadsafe Stats class. Currently, on MRI Ruby the Stats object is already threadsafe, so there is no need to use MutexedStats.
- VERSION
Public Class Methods
The human readable clock name of the CLOCK_ID as a string
Returns¶ ↑
Returns the clock name as a String
# File lib/hitimes/instant.rb, line 37 def clock_name case CLOCK_ID when Symbol CLOCK_ID.to_s else const = Process.constants.grep(/CLOCK/).find { |c| CLOCK_ID == Process.const_get(c) } "Process::#{const.to_s}" end end
::measure { } -> Float
Times the execution of the block, returning the number of seconds it took
# File lib/hitimes.rb, line 22 def self.measure(&block) Hitimes::Interval.measure(&block) end
Public
↑ topConstants
- CLOCK_ID
The clock_id to use in Process.clock_gettime
- CLOCK_RESOLUTION_NANOSECONDS
The resolution of the clock
- CLOCK_RESOLUTION_SECONDS
The smallest fraction of a second hitimes can do
- INSTANT_CONVERSION_FACTOR
The factor used to convert the instant values to fractional seconds
The raw instant values are divided by this value to get float seconds
Private Instance Methods
Internal
↑ topConstants
- NANOSECONDS_PER_SECOND
The fraction of second of a nanosecond
Private Instance Methods
The human readable clock name of the CLOCK_ID as a string
Returns¶ ↑
Returns the clock name as a String
# File lib/hitimes/instant.rb, line 37 def clock_name case CLOCK_ID when Symbol CLOCK_ID.to_s else const = Process.constants.grep(/CLOCK/).find { |c| CLOCK_ID == Process.const_get(c) } "Process::#{const.to_s}" end end