Revisions

gist: 13174 Download_button fork
public
Description:
undefined
Public Clone URL: git://gist.github.com/13174.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
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