criterion-1.0.0.1: Robust, reliable performance measurement and analysis

PortabilityGHC
Stabilityexperimental
Maintainerbos@serpentine.com
Safe HaskellNone

Criterion.Measurement

Description

Benchmark measurement code.

Synopsis

Documentation

initializeTime :: IO ()Source

Set up time measurement.

getTime :: IO DoubleSource

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

You must call initializeTime once before calling this function!

getCPUTime :: IO DoubleSource

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

getCycles :: IO Word64Source

Read the CPU cycle counter.

getGCStats :: IO (Maybe GCStats)Source

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 -> StringSource

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.

measureSource

Arguments

:: Benchmarkable

Operation to benchmark.

-> Int64

Number of iterations.

-> IO (Measured, Double) 

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

runBenchmarkSource

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 :: MeasuredSource

An empty structure.

applyGCStatsSource

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 :: DoubleSource

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.