On 1/2/07, Martin Grabmueller wrote:
version 1.0 of package rdtsc has just been released.
This small package contains one module called 'Rdtsc.Rdtsc'.
This module provides the function 'rdtsc' for accessing
the 'rdtsc' machine register on modern IA-32 processors.

Very nice!

I have a few comments:

1. What happens when someone tries this on a platform
other than IA-32? I would hope for some predictable
exception to be thrown (hopefully not a segfault).

Hmm, checking System.Info.arch would probably
cost a few cycles. I wonder how much difference that
would make. Or maybe there is a CPP macro
that could hide this function completely on non-IA-32?

2. Shouldn't this module be called System.Rtdsc? Or
maybe even System.CPUTime.Rdtsc (even though
to a systems person this is a very different animal,
something feels right about that to me. I think that
is where most people would look for it first.).

...note that you can get strange results
sometimes on a superscalar processor.

There are a number of serious problems with using
RDTSC, so anyone using it should first read up
about it. In particular: using it on a very old machine
could prevent Linux from booting; using it on
recent high-end machines can be very inaccurate
(as Martin pointed out). Microsoft "strongly
discourages" its use on Windows.

That said, in practice many people find RDTSC
very useful.

Source: http://en.wikipedia.org/wiki/RDTSC

Thanks for posting this module.

Regards,
Yitz
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to