On Sun, Mar 13, 2005 at 09:04:03PM +0100, Francisco Olarte Sanz wrote:
>       I've checked the Benchmark module docs, and it's not too clear ( for me 
> ), 
> but I think they measure user/system time of your proccess. If you are 
> executing external code via system/backticks etc.. this is normally done in a 
> child process, a fork away, and not normally counted. I fear Benchmark is 
> oriented to count code in modules/libraries. As someone sugested 
> time/Time::Hires maybe the way to go for your tests.

We can just check.

$ perl -MBenchmark -wle 'timethis(10, sub { `perl -wle "rand for 1..1000000"` 
})'
timethis 10: 11 wallclock secs ( 0.01 usr  0.00 sys +  8.64 cusr  0.14 csys =  
8.79 CPU) @ 1000.00/s (n=10)

So the time spent in a fork counts as cumulative user time and is benchmarked.
The advantage of using Benchmark over just time is you can run the command
multiple times and take advantage of Benchmark's built-in comparision
function, cmpthese().

Reply via email to