module Hitimes
The top level module containing the contents of the hitimes library
use the library with:
require 'hitimes'
Hitimes Constants and module methods
Copyright © 2008 Jeremy Hinegardner All rights reserved. See LICENSE and/or COPYING for details.
Constants
- MutexedStats
-
MutexedStatsis the start of a threadsafeStatsclass. Currently, on MRI Ruby theStatsobject is already threadsafe, so there is no need to useMutexedStats. - VERSION
Public Class Methods
Source
# File lib/hitimes/instant.rb, line 29 def clock_name case CLOCK_ID when Symbol CLOCK_ID.to_s else const = Process.constants.grep(/CLOCK/).find do |id| Process.const_get(id) == CLOCK_ID end "Process::#{const}" end end
Source
# File lib/hitimes.rb, line 24 def self.measure(&block) Hitimes::Interval.measure(&block) end
Hitimes.measure { } -> Float
Times the execution of the block, returning the number of seconds it took
Source
# File lib/hitimes/instant.rb, line 21 def raw_instant Process.clock_gettime(::Hitimes::CLOCK_ID, :nanosecond) end
Public
Constants
- CLOCK_ID
-
The clock_id to use in Process.clock_gettime
Private Instance Methods
Source
# File lib/hitimes/instant.rb, line 21 def raw_instant Process.clock_gettime(::Hitimes::CLOCK_ID, :nanosecond) end
Internal
Constants
- NANOSECONDS_PER_SECOND
-
The fraction of second of a nanosecond
Private Instance Methods
Source
# File lib/hitimes/instant.rb, line 29 def clock_name case CLOCK_ID when Symbol CLOCK_ID.to_s else const = Process.constants.grep(/CLOCK/).find do |id| Process.const_get(id) == CLOCK_ID end "Process::#{const}" end end