Silly precision in a timing macros
Stanley Hopcroft
Stanley.Hopcroft at IPAustralia.Gov.AU
Fri Oct 29 01:51:40 CEST 2004
Dear Folks,
On Thu, Oct 28, 2004 at 03:59:31PM -0700, Jason Martin wrote:
> On Thu, Oct 28, 2004 at 05:47:50PM -0500, Ethan Galstad wrote:
> > > The precision provided by timing macros (for latency and executin
> > > times) are a bit silly, since it holds room for 6 decimal points but
> > > only ever uses 3 of them (a limit in the Linux kernel, I've heard).
Timer resolution this may be a platform dependent ability.
> I'm surprised about that; some of my perl scripts can print time
> periods to 6 decimal points.
>
> The perl module is Time::HiRes.
> If I do something like this:
>
I think you will find that this module is an XS (Perl eXtension) that
calls the system's gettimeofday(), a function that may not be POSIX and
whose resolution varies.
> #Track execution time
> my $t0 = [gettimeofday];
> //[misc stuff]
> print "Stored data for $var on $var2 in " . tv_interval($t0);
>
> , I can get output such as:
> Stored data for ****** on ****** in 0.004562s
>
> Perhaps there is some other limitation causing the time
> precision to be lowered?
BSD systems have a gettimeofday that returns microsecs.
Do you really need this accuracy ?
Milliseconds are fine for me. Prob Seconds are also.
>
> -Jason Martin
Yours sincerely.
--
Stanley Hopcroft
Network specialist, IT Infrastructure
IP Australia
Ph: (02) 6283 3189 Fax: (02) 6281 1353
PO Box 200 Woden ACT 2606
http://www.ipaustralia.gov.au
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: disclaimer.txt
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20041029/20c93561/attachment.txt>
More information about the Developers
mailing list