Last active
December 17, 2015 03:59
-
-
Save ryo0508/5547049 to your computer and use it in GitHub Desktop.
Measure Method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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