Sha256: 9796110868d96d7f9677a5ec2bd68b01cde61b5838f84a7a0346fafa1e31b68d

Contents?: true

Size: 511 Bytes

Versions: 17

Compression:

Stored size: 511 Bytes

Contents

#
# This file defines a $log variable for logging, and a time() method for recording timing
# information.
#
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++


$log = Object.new
def $log.debug(str)
  STDERR.puts str
end

def time(msg, width=25)
  t = Time.now
  return_value = yield
  elapsed = Time.now.to_f - t.to_f
  elapsed = sprintf("%3.3f", elapsed)
  $log.debug "#{msg.ljust(width)}: #{elapsed}s"
  return_value
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
shoesgem-0.1514.0 shoes/ruby/lib/rubygems/timer.rb
shoesgem-0.1480.0 shoes/ruby/lib/rubygems/timer.rb
shoesgem-0.1469.0 shoes/ruby/lib/rubygems/timer.rb
shoesgem-0.1424.0 shoes/ruby/lib/rubygems/timer.rb
rubygems-update-0.9.0 lib/rubygems/timer.rb
rubygems-update-1.1.0 lib/rubygems/timer.rb
rubygems-update-0.9.2 lib/rubygems/timer.rb
rubygems-update-0.9.1 lib/rubygems/timer.rb
rubygems-update-1.0.0 lib/rubygems/timer.rb
rubygems-update-0.9.3 lib/rubygems/timer.rb
rubygems-update-0.9.4 lib/rubygems/timer.rb
rubygems-update-0.9.5 lib/rubygems/timer.rb
rubygems-update-1.0.1 lib/rubygems/timer.rb
rubygems-update-1.1.1 lib/rubygems/timer.rb
rubygems-update-1.3.1 lib/rubygems/timer.rb
rubygems-update-1.3.0 lib/rubygems/timer.rb
rubygems-update-1.2.0 lib/rubygems/timer.rb