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

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Jan 11 10:35:44 EST 2009

On Sun, 2009-01-11 at 16:03 +0100, Peter Verswyvelen wrote:
> wouldn't a double become less and less precise the longer the process
> is running? 
> so Integer sounds like the only datatype that could work here...
> and why not do it like in Windows: make two functions, one that
> returns the number of CPU ticks, and another that returns the
> frequency (number of ticks per second)... This gives you an API that
> works for whatever clock speed...

Let's assume you were joking, but just in case you were not...

Clock speed is variable on all modern CPUs. In low power states some
CPUs can turn off the clock completely. In some CPUs the clock speed is
variable per-core and some can turn off one core without turning off all
cores. Relating clock ticks to time is a minefield.


More information about the Haskell-Cafe mailing list