buildbox-1.0.2.0: Rehackable components for writing buildbots and test harnesses.

BuildBox.Benchmark

Contents

Description

Running benchmarks and collecting timings.

These functions expect the given Build commands to succeed, throwing an error if they don't. If you're not sure whether your command will succeed then test it first.

Synopsis

Documentation

Types

data Benchmark Source

Describes a benchmark that we can run.

Constructors

Benchmark 

Fields

benchmarkName :: String

A unique name for the benchmark.

benchmarkSetup :: Build ()

Setup command to run before the main benchmark.

benchmarkCommand :: Build (Maybe Timing)

The benchmark command to run. Only the time taken to run this part is measured.

benchmarkCheck :: Build ()

Check / cleanup command to run after the main benchmark.

data Timing Source

Holds elapsed, cpu, and system timings (in seconds).

data BenchRunResult Source

The result of running a benchmark once.

Constructors

BenchRunResult 

Fields

benchRunResultElapsed :: Float

The wall-clock time taken to run the benchmark (in seconds)

benchRunResultKernel :: Maybe Timing

Time that the benchmark itself reported was taken to run its kernel.

data BenchResult Source

The result of running a benchmark several times. We include the name of the original benchmark to it's easy to lookup the results.

Benchmarking

runTimedCommand :: Build a -> Build (NominalDiffTime, a)Source

Run a command, returning its elapsed time.

outRunBenchmarkOnce :: Benchmark -> Build BenchRunResultSource

Run a benchmark once, logging activity and timings to the console.

outRunBenchmarkAgainstSource

Arguments

:: Int

Number of iterations.

-> Maybe BenchResult

Optional previous result for comparison.

-> Benchmark

Benchmark to run.

-> Build BenchResult 

Run a benchmark several times, logging activity to the console. Optionally print a comparison with a prior results.

outRunBenchmarkWithSource

Arguments

:: Int

Number of times to run each benchmark to get averages.

-> [BenchResult]

List of prior results.

-> Benchmark

The benchmark to run.

-> Build BenchResult 

Run a benchmark serveral times, logging activity to the console. Also lookup prior results for comparison from the given list. If there is no matching entry then run the benchmark anyway, but don't print the comparison.