Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

mod_perl 2.0 and Benchmark and Time::Hires results in multiples of .015625

by mbeast (Beadle)
on Oct 22, 2004 at 14:13 UTC ( [id://401480]=perlquestion: print w/replies, xml ) Need Help??

mbeast has asked for the wisdom of the Perl Monks concerning the following question:

I have been tracking the time it takes to execute my scripts using Benchmark. Recently I converted from using mod_perl Registry to making the script a handler. My results when using Registry were random, however as a handler my results are always a multiple of .01562500.
use Benchmark; use Time::HiRes qw(gettimeofday tv_interval); sub handler { my $start_time = new Benchmark; some subs; my $end_time = new Benchmark; my $compute_time = timediff($end_time, $start_time); }
I've also tried this:
use Time::HiRes qw(gettimeofday tv_interval); sub handler { my $start_time = [ gettimeofday ]; some subs; my $end_time = [ gettimeofday ]; my $compute_time = tv_interval($start_time_t,$end_time_t); }
with the same results. (0.01562500, 0.03125000, 0.04687500,...)

EDIT for simonm: Win2000, Perl version v5.8.4, Apache/2.0.50, mod_perl 1.9916, Benchmark 1.06, Time::HiRes 1.59

Replies are listed 'Best First'.
Re: mod_perl 2.0 and Benchmark and Time::Hires results in multiples of .015625
by simonm (Vicar) on Oct 22, 2004 at 14:49 UTC
    I'm not sure what the problem is, but I found it interesting that the interval was exactly 1/64th of a second.

    Is this a Unix platform, Windows, or something more obscure?

Re: mod_perl 2.0 and Benchmark and Time::Hires results in multiples of .015625
by iburrell (Chaplain) on Oct 22, 2004 at 16:51 UTC
    On Windows, Time::HiRes doesn't have very good resolution. 1/64 s sounds about right. The API it uses has the poor resolution.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://401480]
Approved by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2025-06-21 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.