Skip to content

Instantly share code, notes, and snippets.

@19WAS85
Created September 26, 2008 18:40
Show Gist options
  • Save 19WAS85/13174 to your computer and use it in GitHub Desktop.
Save 19WAS85/13174 to your computer and use it in GitHub Desktop.
undefined
def benchmark(benchmark_name)
return unless block_given?
initial = Time.now
yield
final = Time.now.to_f - initial.to_f
puts "Benchmark #{benchmark_name}: [#{final}] seconds."
end
benchmark 'Sleep Test' do
sleep 0.318
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment