criterion-1.1.4.0: Robust, reliable performance measurement and analysis

Copyright | (c) 2009-2014 Bryan O'Sullivan
License | BSD-style
Maintainer | bos@serpentine.com
Stability | experimental
Portability | GHC
Safe Haskell | Trustworthy
Language | Haskell98

Criterion.Measurement

Description

Benchmark measurement code.

Synopsis

- initializeTime :: IO ()
- getTime :: IO Double
- getCPUTime :: IO Double
- getCycles :: IO Word64
- getGCStats :: IO (Maybe GCStats)
- secs :: Double -> String
- measure :: Benchmarkable -> Int64 -> IO (Measured, Double)
- runBenchmark :: Benchmarkable -> Double -> IO (Vector Measured, Double)
- measured :: Measured
- applyGCStats :: Maybe GCStats -> Maybe GCStats -> Measured -> Measured
- threshold :: Double

# Documentation

initializeTime :: IO () #

Set up time measurement.

getTime :: IO Double #

Return the current wallclock time, in seconds since some arbitrary time.

You must call `initializeTime` once before calling this function!

getCPUTime :: IO Double #

Return the amount of elapsed CPU time, combining user and kernel (system) time into a single measure.

getCycles :: IO Word64 #

Read the CPU cycle counter.

getGCStats :: IO (Maybe GCStats) #

Try to get GC statistics, bearing in mind that the GHC runtime will throw an exception if statistics collection was not enabled using "`+RTS -T`".

secs :: Double -> String #

Convert a number of seconds to a string. The string will consist of four decimal places, followed by a short description of the time units.

measure #

Arguments

:: Benchmarkable | Operation to benchmark.
-> Int64 | Number of iterations.
-> IO (Measured, Double) |

Measure the execution of a benchmark a given number of times.

runBenchmark #

Arguments

:: Benchmarkable |
-> Double | Lower bound on how long the benchmarking process should take. In practice, this time limit may be exceeded in order to generate enough data to perform meaningful statistical analyses.
-> IO (Vector Measured, Double) |

Run a single benchmark, and return measurements collected while executing it, along with the amount of time the measurement process took.

measured :: Measured #

An empty structure.

applyGCStats #

Arguments

:: Maybe GCStats | Statistics gathered at the end of a run.
-> Maybe GCStats | Statistics gathered at the beginning of a run.
-> Measured | Value to "modify".
-> Measured |

Apply the difference between two sets of GC statistics to a measurement.

threshold :: Double #

The amount of time a benchmark must run for in order for us to have some trust in the raw measurement.

We set this threshold so that we can generate enough data to later perform meaningful statistical analyses.

The threshold is 30 milliseconds. One use of `runBenchmark` must accumulate more than 300 milliseconds of total measurements above this threshold before it will finish.