Sha256: c772b731551e9f64e86617387ce92d97c5af11ef4908bd4310faacbe28c1f848

Contents?: true

Size: 1.51 KB

Versions: 17

Compression:

Stored size: 1.51 KB

Contents

#--
# Copyright (c) 2008 Jeremy Hinegardner
# All rights reserved.  See LICENSE and/or COPYING for details.
#++

#
# The top level module containing the contents of the hitimes library
#
# use the library with:
#
#   require 'hitimes'
#
module Hitimes
  #
  # Base class of all errors in Hitimes
  #
  class Error < ::StandardError; end

  # Hitimes.measure { } -> Float
  #
  # Times the execution of the block, returning the number of seconds it took
  def self.measure(&block)
    Hitimes::Interval.measure(&block)
  end
end
require 'hitimes/paths'
require 'hitimes/version'

# Load the binary extension, try loading one for the specific version of ruby
# and if that fails, then fall back to one in the top of the library.
# this is the method recommended by rake-compiler

attempts = [
  "hitimes/#{RUBY_VERSION.sub(/\.\d+$/,'')}/hitimes",
  "hitimes/hitimes"
]
loaded = false

path_exceptions = []
attempts.each do |path|
  begin
    require path
    loaded = true
    break
  rescue LoadError => load_error
    full_path = File.expand_path(path)
    path_exceptions << [ full_path, load_error.message ]
  end
end

if !loaded then
  msg = ["Unable to find binary extension, was hitimes installed correctly? The following paths were tried."]
  path_exceptions.each do |path, message|
    msg << "#{path} : #{message}"
  end
  raise LoadError, msg.join("\n")
end

require 'hitimes/stats'
require 'hitimes/mutexed_stats'

require 'hitimes/metric'
require 'hitimes/value_metric'
require 'hitimes/timed_metric'
require 'hitimes/timed_value_metric'

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hitimes-1.3.1-x64-mingw32 lib/hitimes.rb
hitimes-1.3.1-x86-mingw32 lib/hitimes.rb
hitimes-1.3.1-java lib/hitimes.rb
hitimes-1.3.1 lib/hitimes.rb
hitimes-1.3.0-x64-mingw32 lib/hitimes.rb
hitimes-1.3.0-x86-mingw32 lib/hitimes.rb
hitimes-1.3.0-java lib/hitimes.rb
hitimes-1.3.0 lib/hitimes.rb
hitimes-1.2.6-x86-mingw32 lib/hitimes.rb
hitimes-1.2.6-java lib/hitimes.rb
hitimes-1.2.6 lib/hitimes.rb
hitimes-1.2.5-java lib/hitimes.rb
hitimes-1.2.5-x86-mingw32 lib/hitimes.rb
hitimes-1.2.5 lib/hitimes.rb
hitimes-1.2.4-java lib/hitimes.rb
hitimes-1.2.4-x86-mingw32 lib/hitimes.rb
hitimes-1.2.4 lib/hitimes.rb