Created
November 25, 2012 14:42
-
-
Save hoshinotsuyoshi/4143782 to your computer and use it in GitHub Desktop.
ある処理の実行時間を計る
This file contains 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
def time_watch(&b) | |
t1 = Time.now | |
yield | |
t2 = Time.now | |
t2-t1 | |
end | |
time_watch{sleep 4} | |
#=> 4.000228 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment