rdtsc-enolan-0.1: Binding to sources of high-efficiency, high-precision, monotonically increasing relative time.

Portabilityat own risk. Amd64/linux tested and working.
Stabilityexperimental
Maintainerecho@echonolan.net
Safe HaskellNone

System.CPUTime.Rdtsc

Description

This module provides the function rdtsc for accessing the equivalent of x86's rdtsc instruction on your processor. To oversimplify quite a bit, this is the number of clock cycles since bootup. You should generally only use this as a source of relative time.

As an example, you may use the following program to measure the overhead of calling this function:

 module Main where
 import System.CPUTime.Rdtsc

 main = do
   t1 <- rdtsc
   t2 <- rdtsc
   putStrLn ("Cost of rdtsc (ffi call):    " ++ show (t2 - t1))

Documentation