Subject: Re: microtime
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 08/22/2002 09:17:41
On Wed, Aug 21, 2002 at 04:25:06PM -0700, Jonathan Stone wrote:
> 
> 
> >Dangerous, it starts getting possible for nanosecond counts to
> >wrap 64 bit integers. 1 sec ~= 2^30 nanoseconds, so that would be
> >about 1000 years - ok until you start summing times across the
> >processes on a 1000+ cpu system, or want to keep time since
> >a sensible epoch.
> 
> There's this thing called a "struct timespec", and code which folds
> multiples of 2^9 nanoseconds into a separate second field, when
> timespecs are added or subtracted.

Yes - typically limits you to 2^31 seconds (~65 years) since the
seconds value is signed.  It also requires horrid arithmetic.

> >If you are actually trying to measure the execution time of
> >short code fragments (as opposed to process execution times)
> >the raw counts from the fastest counter you have are
> >probably best - without any attenpt to scale them to match
> >reality.
> 
> Yes, of course (until perhaps one presents them to a human), but
> isn't that rather a novice-level elementary point?  I do it day in
> and day out.  I wouldn't have considered it appropriate for
> this venue, myself.
> 
> Should I revise my estimate of the technical savvy of tech-kern?

I was just pointing out that nanosecond timings are not
necessary for anything 'normal' that a system would do.

	David

-- 
David Laight: david@l8s.co.uk