-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Binding for the rdtsc machine instruction
--   
--   This module provides the function <a>rdtsc</a> for accessing the
--   <a>rdtsc</a> machine register on modern IA-32 processors. This is a
--   64-bit counter which counts the number of processor cycles since the
--   machine has been powered up. Using this instruction, you can make very
--   precise time measurements which are independent of the actual CPU
--   frequency. But note that you can get strange results sometimes on a
--   superscalar processor.
--   
--   Also note that the Haskell foreign function interface imposes some
--   additional overheads. On my machine, it takes about 950 cycles to call
--   this function twice and to compute the difference, whereas in C the
--   overhead is only about 88 cycles.
@package rdtsc
@version 1.3.0.1


-- | This module provides the function "rdtsc" for accessing the rdtsc
--   machine register on modern IA-32 processors. This is a 64-bit counter
--   which counts the number of processor cycles since the machine has been
--   powered up.
--   
--   As an example, you may use the following program to measure the
--   overhead of calling this function:
--   
--   <pre>
--   module Main where
--   import System.CPUTime.Rdtsc
--   
--   main = do
--     t1 &lt;- rdtsc
--     t2 &lt;- rdtsc
--     putStrLn ("Cost of rdtsc (ffi call):    " ++ show (t2 - t1))
--   </pre>
module System.CPUTime.Rdtsc

-- | Return the number of clock cycles since the machine this function is
--   called on has been powered up. Note that the value returned may be
--   inaccurate if the program is run on some hardware virtualization
--   layer.
--   
--   Especially on multi-core processors and when using hibernating
--   operating systems, the values returned may be bogus.
--   
--   For more information about the <tt>rdtsc</tt> instruction, see
--   <a>http://en.wikipedia.org/wiki/RDTSC</a>
rdtsc :: IO Word64
