[Haskell-cafe] Re: System.CPUTime and picoseconds

Tony Finch dot at dotat.at
Mon Jan 12 07:55:07 EST 2009


On Mon, 12 Jan 2009, ChrisK wrote:
>
> Lennart is right that 1 picosecond accuracy is absurd compared to all
> the jitters and drifts in anything but an actual atomic clock in your
> room.  But since CPUs tick faster than nanosecond the CPUTime needs
> better than 1 nanosecond granularity.  I agree with Lennart — I also
> want an Integral type; it keeps the granularity constant and avoids all
> the pitfalls of doing math with a Double.  Out of simplicity I can see
> why the granularity was set to 1 picosecond as it is slightly easier to
> specify than 100 picosecond or 10 picosecond or 1/60 nanosecond (hmmm...
> arcnanosecond?).

The FreeBSD kernel uses a 64+64 bit fixed point type to represent time,
where the integer part is a normal Unix time_t. The fractional part is
64 bits wide in order to be able to represent multi-GHz frequencies
precisely.

http://phk.freebsd.dk/pubs/timecounter.pdf

Tony.
-- 
f.anthony.n.finch  <dot at dotat.at>  http://dotat.at/
TYNE DOGGER FISHER GERMAN BIGHT HUMBER: SOUTHWEST 7 TO SEVERE GALE 9
DECREASING 5 OR 6 LATER. MODERATE TO VERY ROUGH, DECREASING SLIGHT TO ROUGH
LATER. OCCASIONAL RAIN. MODERATE OR GOOD.


More information about the Haskell-Cafe mailing list