Copyright | (c) 2009-2014 Bryan O'Sullivan |
---|---|
License | BSD-style |
Maintainer | bos@serpentine.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Benchmark measurement code.
- initializeTime :: IO ()
- getTime :: IO Double
- getCPUTime :: IO Double
- getCycles :: IO Word64
- getGCStatistics :: IO (Maybe GCStatistics)
- data GCStatistics = GCStatistics {
- gcStatsBytesAllocated :: !Int64
- gcStatsNumGcs :: !Int64
- gcStatsMaxBytesUsed :: !Int64
- gcStatsNumByteUsageSamples :: !Int64
- gcStatsCumulativeBytesUsed :: !Int64
- gcStatsBytesCopied :: !Int64
- gcStatsCurrentBytesUsed :: !Int64
- gcStatsCurrentBytesSlop :: !Int64
- gcStatsMaxBytesSlop :: !Int64
- gcStatsPeakMegabytesAllocated :: !Int64
- gcStatsMutatorCpuSeconds :: !Double
- gcStatsMutatorWallSeconds :: !Double
- gcStatsGcCpuSeconds :: !Double
- gcStatsGcWallSeconds :: !Double
- gcStatsCpuSeconds :: !Double
- gcStatsWallSeconds :: !Double
- secs :: Double -> String
- measure :: Benchmarkable -> Int64 -> IO (Measured, Double)
- runBenchmark :: Benchmarkable -> Double -> IO (Vector Measured, Double)
- runBenchmarkable :: Benchmarkable -> Int64 -> (a -> a -> a) -> (IO () -> IO a) -> IO a
- runBenchmarkable_ :: Benchmarkable -> Int64 -> IO ()
- measured :: Measured
- applyGCStatistics :: Maybe GCStatistics -> Maybe GCStatistics -> Measured -> Measured
- threshold :: Double
- getGCStats :: IO (Maybe GCStats)
- applyGCStats :: Maybe GCStats -> Maybe GCStats -> Measured -> Measured
Documentation
initializeTime :: IO () Source #
Set up time measurement.
Return the current wallclock time, in seconds since some arbitrary time.
You must call initializeTime
once before calling this function!
getCPUTime :: IO Double Source #
Return the amount of elapsed CPU time, combining user and kernel (system) time into a single measure.
getGCStatistics :: IO (Maybe GCStatistics) 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
".
data GCStatistics Source #
Statistics about memory usage and the garbage collector. Apart from
gcStatsCurrentBytesUsed
and gcStatsCurrentBytesSlop
all are cumulative values since
the program started.
GCStatistics
is cargo-culted from the GCStats
data type that GHC.Stats
has. Since GCStats
was marked as deprecated and will be removed in GHC 8.4,
we use GCStatistics
to provide a backwards-compatible view of GC statistics.
GCStatistics | |
|
secs :: Double -> String Source #
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.
:: Benchmarkable | Operation to benchmark. |
-> Int64 | Number of iterations. |
-> IO (Measured, Double) |
Measure the execution of a benchmark a given number of times.
:: 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.
runBenchmarkable :: Benchmarkable -> Int64 -> (a -> a -> a) -> (IO () -> IO a) -> IO a Source #
runBenchmarkable_ :: Benchmarkable -> Int64 -> IO () Source #
:: Maybe GCStatistics | Statistics gathered at the end of a run. |
-> Maybe GCStatistics | 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.
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.
Deprecated
getGCStats :: IO (Maybe GCStats) Source #
Deprecated: GCStats has been deprecated in GHC 8.2. As a consequence,getGCStats has also been deprecated in favor of getGCStatistics.getGCStats will be removed in the next major criterion release.
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
".
:: 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 |
Deprecated: GCStats has been deprecated in GHC 8.2. As a consequence,applyGCStats has also been deprecated in favor of applyGCStatistics.applyGCStats will be removed in the next major criterion release.
Apply the difference between two sets of GC statistics to a measurement.