A DSL for benchmark descriptions embedded into Curry
Author: Michael Hanus
Version: November 2014
benchmark
:: IO a -> Benchmark a
A benchmark is basically an I/O action to compute the benchmark results. |
withPrepare
:: Benchmark a -> IO () -> Benchmark a
Adds some initial preparation action to a benchmark, e.g., to generate benchmark data. |
withCleanup
:: Benchmark a -> IO () -> Benchmark a
Adds some final cleanup action to a benchmark. |
prepareBenchmarkCleanup
:: IO () -> IO a -> IO () -> Benchmark a
A benchmark with some preparation and some final cleanup. |
iterateBench
:: ([a] -> b) -> Int -> Benchmark a -> Benchmark b
Iterates a benchmark multiple times and computes the average according to a given average function (first argument). |
(*>)
:: Int -> Benchmark Float -> Benchmark Float
Iterates a float-valued benchmark multiple times and computes the average. |
(*>-)
:: Int -> Benchmark (Maybe Float) -> Benchmark (Maybe Float)
Iterates a (Maybe Float) -valued benchmark multiple times and
computes the average.
|
mapBench
:: (a -> b) -> Benchmark a -> Benchmark b
Maps benchmark results according to a given mapping (first argument). |
pairBench
:: Benchmark a -> Benchmark b -> Benchmark (a,b)
Combines two benchmarks to a single benchmark where the results are paired. |
diffBench
:: (a -> a -> a) -> Benchmark a -> Benchmark a -> Benchmark a
Computes the difference between two benchmarks according to a given difference operation (first argument). |
(.-.)
:: Benchmark Float -> Benchmark Float -> Benchmark Float
Computes the numeric difference between two Float-valued benchmarks. |
(>!>=)
:: Benchmark a -> (a -> Benchmark b) -> Benchmark b
Executes two benchmarks in sequential order. |
returnBM
:: a -> Benchmark a
A benchmark that just returns a given value. |
runOn
:: (a -> Benchmark b) -> [a] -> Benchmark [(a,b)]
Runs a parameterized benchmark on a list of input data. |
runUntilOn
:: (a -> Benchmark b) -> (b -> Bool) -> [a] -> Benchmark [(a,b)]
Runs a Maybe
benchmark on an (infinite) input list of values
until a benchmark delivers Nothing .
|
runUntilNothingOn
:: (a -> Benchmark (Maybe b)) -> [a] -> Benchmark [(a,b)]
Run a Maybe
benchmark on an (infinite) input list of values
until a benchmark delivers Nothing .
|
execBench
:: Benchmark a -> IO a
Executes a benchmark and returns the benchmark results. |
benchTimeNF
:: IO a -> Benchmark Float
Benchmark the time (in seconds) to compute the normal form of an expression. |
benchCommandOutput
:: String -> Benchmark (Int,String,String)
This operation constructs a benchmark that simply returns the output of a shell command. |
cmdResultAverage
:: [CmdResult] -> CmdResult
The average of a list of command benchmark results. |
exitStatus
:: CmdResult -> Int
The exit status of the command benchmark result. |
elapsedTime
:: CmdResult -> Float
The elapsed time (in seconds) of the command benchmark result. |
cpuTime
:: CmdResult -> Float
The cpu time (in seconds) of the command benchmark result. |
systemTime
:: CmdResult -> Float
The system time (in seconds) of the command benchmark result. |
maxResidentMemory
:: CmdResult -> Int
The maximum resident size (in Kilobytes) of the command benchmark result. |
benchCommand
:: String -> Benchmark CmdResult
Benchmark the execution of a shell command. |
elapsedTime4Command
:: String -> Benchmark Float
Benchmark the elapsed time (in seconds) to execute a shell command. |
cpuTime4Command
:: String -> Benchmark Float
Benchmark the cpu time (in seconds) to execute a shell command. |
benchCommandWithLimit
:: String -> Float -> Benchmark (Maybe CmdResult)
Benchmark the execution of a shell command where a maximum time limit for the execution (in seconds) is given. |
getHostName
:: IO String
Retrieve the host name. |
getOS
:: IO String
Retrieve the operating system name (e.g., "Linux"). |
getSystemDescription
:: IO String
Retrieve the operating system description (e.g., "Ubuntu 12.04.3 LTS"). |
getSystemID
:: IO String
Retrieve the operating system id (e.g., "Ubuntu"). |
getSystemRelease
:: IO String
Retrieve the operating system release (e.g., "12.04"). |
getCoreNumber
:: IO String
Retrieve the number of cores. |
getCPUModel
:: IO String
Retrieve the model of the CPU (e.g., "Intel(R) Core(TM) i5 CPU..."). |
Representation of benchmarks. A benchmark consists of some preparation, e.g., to generate benchmark data, some final cleanup, and the benchmark itself. If a benchmark is executed several times, the preparation and cleanup work is done only once.
Constructors:
The result type for benchmarks timing the executing a shell command. Currently, a result contains the command, exit status, elapsed time, cpu time, system time (in seconds), and the maximum resident size (in Kilobytes).
Constructors:
A benchmark is basically an I/O action to compute the benchmark results.
|
Adds some initial preparation action to a benchmark, e.g., to generate benchmark data. If the benchmark already contains some preparation, this new preparation is executed first. |
Adds some final cleanup action to a benchmark. If the benchmark already contains some cleanup action, this new cleanup is executed last. |
A benchmark with some preparation and some final cleanup. In this case, the preparation and cleanup work tightly belongs to the benchmark, i.e., it is repeated with every iteration of the benchmark. |
Iterates a benchmark multiple times and computes the average according to a given average function (first argument). The preparation and cleanup actions of the benchmark are only executed once, i.e., they are not iterated. |
Iterates a float-valued benchmark multiple times and computes the average. The number of executions (first argument) must be postive. |
Iterates a |
Maps benchmark results according to a given mapping (first argument). |
Combines two benchmarks to a single benchmark where the results are paired. |
Computes the difference between two benchmarks according to a given difference operation (first argument). This could be useful to evaluate some kernel of a computation where the ressources to prepare the benchmark data are measured by a separate benchmark and subtracted with this operation. |
Computes the numeric difference between two Float-valued benchmarks. This could be useful to evaluate some kernel of a computation where the ressources to prepare the benchmark data are measured by a separate benchmark and subtracted with this operation. |
Executes two benchmarks in sequential order. The second benchmark
has the result of the first benchmark as an argument so that
its behavior can depend on the first benchmark result.
An example use is shown in the operation |
A benchmark that just returns a given value.
|
Runs a parameterized benchmark on a list of input data. The result is a benchmark returning a list of pairs consisting of the input data and the benchmark result for this input data.
|
Runs a
|
Run a
|
Benchmark the time (in seconds) to compute the normal form of an expression. The expression is created by an I/O action (first parameter). This avoids the sharing of the normalization process between multiple runs of the benchmark and provides more flexibility, e.g., to read benchmark input data from global variables. |
This operation constructs a benchmark that simply returns the output of a shell command. To be more precise, the constructed benchmark contains as a result the exit status and the standard and error output string produced by the execution of the given shell command (provided as the argument). |
The average of a list of command benchmark results. The exit status average is zero of all are zero. |
The exit status of the command benchmark result.
|
The elapsed time (in seconds) of the command benchmark result. If the exit status is non-zero, an error is raised. |
The cpu time (in seconds) of the command benchmark result. If the exit status is non-zero, an error is raised. |
The system time (in seconds) of the command benchmark result. If the exit status is non-zero, an error is raised. |
The maximum resident size (in Kilobytes) of the command benchmark result. If the exit status is non-zero, an error is raised. |
Benchmark the execution of a shell command. Returns benchmark results containing the exit status, elapsed time, cpu time, system time, and the maximum resident size (in Kilobytes). |
Benchmark the elapsed time (in seconds) to execute a shell command. |
Benchmark the cpu time (in seconds) to execute a shell command. |
Benchmark the execution of a shell command where
a maximum time limit for the execution (in seconds) is given.
Returns |
Retrieve the host name. |
Retrieve the operating system name (e.g., "Linux"). |
Retrieve the operating system description (e.g., "Ubuntu 12.04.3 LTS"). |
Retrieve the operating system id (e.g., "Ubuntu"). |
Retrieve the operating system release (e.g., "12.04"). |
Retrieve the number of cores. Implemented by counting the processor entries in /proc/cpuinfo |
Retrieve the model of the CPU (e.g., "Intel(R) Core(TM) i5 CPU..."). Implemented by look up the model name in /proc/cpuinfo. The copyright and trademark abbreviations are omitted. |