Skip to content

Instantly share code, notes, and snippets.

@ryo0508
Last active December 17, 2015 03:59
Show Gist options
  • Save ryo0508/5547049 to your computer and use it in GitHub Desktop.
Save ryo0508/5547049 to your computer and use it in GitHub Desktop.
Measure Method
#
# How to use
# measure :key do
# code you want to measure...
# end
#
def measure(key = nil)
p "#{caller[0]}: #{key} : start"
st = Time.now
yield
et = Time.now
p "#{caller[0]} : #{key} : #{sprintf('%.3f', (et - st) * 1000)} [msec]"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment