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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.