SPUG: Benchmark.pm broken?
jimfl at colltech.com
Thu Jan 20 19:18:45 CST 2000
--On Thursday, January 20, 2000 3:03 PM -0800 "Tim Maher/CONSULTIX"
<tim at consultix-inc.com> wrote:
> Here's output from a sample run:
> Benchmark: timing 50 iterations of first, second...
> first: 4 wallclock secs ( 0.09 usr 0.11 sys + 0.84 cusr
> 2.33 csys = 0.00 CPU) second: 3 wallclock secs ( 0.05 usr
> 0.20 sys + 0.83 cusr 2.38 csys = 0.00 CPU)
> Perl Version: 5.00502
> (results same with 5.00503, and different numbers of iterations)
> Anybody understand what's wrong here?
A Benchmark object is a blessed list that is presumed to have only 5
elements in it by the code in Benchmark::timestr() that prints out the
line. That line looks something like:
$s = sprintf("%2d wallclock.....CPU", @t, $t) if $style eq 'all';
The only problem is that somehow, the Benchmark object (@t in this case)
is getting an extra zero appended to it (I haven't figured out where.)
Changing the above line to
$s = sprintf("%2d wallclock.....CPU", @t[0..4], $t) if $style eq 'all';
Solves the problem.
Jim Flanagan Collective Technologies
jimfl at colltech.com http://www.colltech.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list