On Mon, Mar 14, 2005 at 01:48:23AM +0000, Mark Stosberg wrote:
> On 2005-03-14, Michael G Schwern <[EMAIL PROTECTED]> wrote:
> > On Mon, Mar 14, 2005 at 01:25:16AM +0000, Mark Stosberg wrote:
> >> I'm sorry-- I could have made this more productive by posting my own 
> >> Benchmark
> >> code in the first place. Look what happens when cmpthese is used. The
> >> results look nonsensical to me:
> >
> > Hmm.  I guess the comparison isn't taking into account the cusr time. :(
> 
> So is that a Benchmark bug then? Seems like it to me. 

Looks like it.  Or by design.  The cmpthese() code only looks at the process 
CPU and System time ignoring the system time.  The wacky percentages you're 
getting are because it adds an epsilon so even if pcpu and psys are both 0 
you're still considered to be 0.0000001.

    for (@vals) {
        # The epsilon fudge here is to prevent div by 0.  Since clock
        # resolutions are much larger, it's below the noise floor.
        my $rate = $_->[6] / ( $_->[2] + $_->[3] + 0.000000000000001 );
        $_->[7] = $rate;
    }

However, the internals are a bit incomprehensible.  (Array objects)--
$_->[6] is the # of runs, $_->[2] is pcpu and $_->[3] is psys.


> Even in a more 'normal' case, if a code block was because it was making
> system calls, it seems like you'd want a benchmarking tool to report
> that. 
> 
> Or perhaps I'm missing some flag to turn on in Benchmark.pm

That would seem more like it.  I can see cases where one would not want to
take into account external process time.

Reply via email to