From: Hal Fulton Date: 2005-04-13T09:16:07+09:00 Subject: Elapsed time -- tiny code snippet Here's a poor man's profiler -- only good for finding the time in seconds it took to execute a code block. (I used this today in a context where I was doing several operations that invoked external programs and such.) I put it inside Time just for convenience. Cheers, Hal class Time def self.elapse raise "Need block" unless block_given? t0 = Time.now yield Time.now - t0 end end secs = Time.elapse { do_something() }