From: "Sandor Szücs" Date: 2009-02-26T05:56:11+09:00 Subject: Re: Help interpreting benchmark results On 25.02.2009, at 13:20, Robert Klemme wrote: > 2009/2/25 Sandor Szücs : >> >> No. "real" measures the time that is passed from start to finish. >> >> Pseudocode >> real_start = Time.now >> yield # run test >> real_end = Time.now >> real_start.to_f - real_end.to_f >> >> >> If the Kernel of your OS schedules another processes for, say 20 >> seconds, >> then the difference between total and real is >= 20 seconds. >> I think the time called "real" should not be trusted in an >> evaluation. > > Not so fast. If another process has been running that may well be a > process spawned by our process. Full ack that's right, if a process forks, like system() do you can measure that one too. Benchmark.bm(20) do |b| b.report 'fork' do pid = Process.fork { sleep 3 } Process.waitpid pid end end user system total real fork 0.000000 0.010000 0.020000 ( 3.008273) regards, Sandor Szücs --