Safe Haskell | None |
---|---|
Language | Haskell2010 |
tick
uses the rdtsc chipset to measure time performance of a computation.
The measurement unit is one oscillation of the chip crystal as measured by the rdtsc instruction which inspects the TSC register.
For reference, a computer with a frequency of 2 GHz means that one cycle is equivalent to 0.5 nanoseconds.
Synopsis
- tick_ :: IO Cycles
- warmup :: Int -> IO ()
- tick :: (a -> b) -> a -> IO (Cycles, b)
- tickWHNF :: (a -> b) -> a -> IO (Cycles, b)
- tickLazy :: (a -> b) -> a -> IO (Cycles, b)
- tickForce :: (NFData a, NFData b) => (a -> b) -> a -> IO (Cycles, b)
- tickForceArgs :: NFData a => (a -> b) -> a -> IO (Cycles, b)
- tickIO :: IO a -> IO (Cycles, a)
- ticks :: Int -> (a -> b) -> a -> IO ([Cycles], b)
- ticksIO :: Int -> IO a -> IO ([Cycles], a)
- newtype Cycles = Cycles {}
- cputime :: StepMeasure IO Integer
- clocktime :: StepMeasure IO Double
- time :: Measure IO Cycles
- times :: Int -> Measure IO [Cycles]
- stepTime :: StepMeasure IO Cycles
Documentation
tick_ measures the number of cycles it takes to read the rdtsc chip twice: the difference is then how long it took to read the clock the second time.
warmup :: Int -> IO () Source #
Warm up the register, to avoid a high first measurement. Without a warmup, one or more larger values can occur at the start of a measurement spree, and often are in the zone of an L2 miss.
tick :: (a -> b) -> a -> IO (Cycles, b) Source #
tick f a
- strictly evaluates f and a to WHNF
- starts the cycle counter
- strictly evaluates f a to WHNF
- stops the cycle counter
- returns (number of cycles, f a)
tickWHNF :: (a -> b) -> a -> IO (Cycles, b) Source #
tickWHNF f a
- starts the cycle counter
- strictly evaluates f a to WHNF (this may also kick off thunk evaluation in f or a which will also be captured in the cycle count)
- stops the cycle counter
- returns (number of cycles, f a)
tickLazy :: (a -> b) -> a -> IO (Cycles, b) Source #
tickLazy f a
- starts the cycle counter
- lazily evaluates f a
- stops the cycle counter
- returns (number of cycles, f a)
tickForce :: (NFData a, NFData b) => (a -> b) -> a -> IO (Cycles, b) Source #
tickForce f a
- deeply evaluates f and a,
- starts the cycle counter
- deeply evaluates f a
- stops the cycle counter
- returns (number of cycles, f a)
tickForceArgs :: NFData a => (a -> b) -> a -> IO (Cycles, b) Source #
tickForceArgs f a
- deeply evaluates f and a,
- starts the cycle counter
- strictly evaluates f a to WHNF
- stops the cycle counter
- returns (number of cycles, f a)
ticks :: Int -> (a -> b) -> a -> IO ([Cycles], b) Source #
n measurements of a tick
returns a list of Cycles and the last evaluated f a
ticksIO :: Int -> IO a -> IO ([Cycles], a) Source #
n measurements of a tickIO
returns an IO tuple; list of Cycles and the last evaluated f a
Clock count.
Instances
cputime :: StepMeasure IO Integer Source #
a measure using getCPUTime
from System.CPUTime (unit is picoseconds)
clocktime :: StepMeasure IO Double Source #
a measure using getCurrentTime
(unit is seconds)
stepTime :: StepMeasure IO Cycles Source #
tick as a StepMeasure