Skip to content

Instantly share code, notes, and snippets.

@hoshinotsuyoshi
Created November 25, 2012 14:42
Show Gist options
  • Save hoshinotsuyoshi/4143782 to your computer and use it in GitHub Desktop.
Save hoshinotsuyoshi/4143782 to your computer and use it in GitHub Desktop.
ある処理の実行時間を計る
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