develooper Front page | perl.perl5.porters | Postings from June 2016

Re: [perl #128349] Benchmark module doesn't use documented formatfor times

Thread Previous | Thread Next
From:
Zefram
Date:
June 8, 2016 23:16
Subject:
Re: [perl #128349] Benchmark module doesn't use documented formatfor times
Message ID:
20160608231555.GD1170@fysh.org
Linda Walsh wrote:
>I looked at the Benchmark modules and it seems the bugs for it are in
>the perl5 category -- I guess that means it's part of 'Core'?

The module is distributed only with the Perl core; this is indeed the
correct place to report issues with it.

>time_str=4.36661 wallclock secs (         0.010000000 usr          0.000000000 sys +          0.390000000 cusr          1.460000000 csys =          1.860000000 CPU)
>
>note, at the top, I have:
>use Benchmark qw(:all :hireswallclock);
>
>So, it should be giving microsecond accuracy.

As the name suggests, and as the documentation explicitly says,
:hireswallclock enables high-resolution timing *of the wallclock time*.
That's how you got a fractional "4.36661 wallclock secs".  The CPU timers
are unaffected by this option.

As you note, higher-resolution CPU timers are available on some hosts
via the POSIX clock interface.  It would be nice for Benchmark.pm to
use those where available, but it is not a bug that it does not.

The documentation is not clear that the format string passed to
timestr() is only used for the CPU time fields.  This is a flaw in the
documentation.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About