serokell-util-0.10.0: General-purpose functions by Serokell

Safe HaskellNone
LanguageHaskell2010

Serokell.Util.Bench

Description

Benchmark related utils.

Synopsis

Documentation

getWallTime :: forall unit m. (MonadIO m, KnownDivRat Nanosecond unit) => m (Time unit) Source #

Get current wall-clock time as any time unit.

getCpuTime :: forall unit m. (MonadIO m, KnownDivRat Nanosecond unit) => m (Time unit) Source #

Get current CPU time as any time unit.

data ElapsedTime Source #

Data type describing time passed during execution of something.

Instances
Show ElapsedTime Source # 
Instance details

Defined in Serokell.Util.Bench

Buildable ElapsedTime Source # 
Instance details

Defined in Serokell.Util.Bench

Methods

build :: ElapsedTime -> Builder #

measureTime :: MonadIO m => m a -> m (ElapsedTime, a) Source #

Run given action and measure how much time it took.

measureTime_ :: MonadIO m => m a -> m ElapsedTime Source #

Run given action and measure how much time it took, discarding result of action.

perSecond :: (Real a, Fractional b) => a -> TimeSpec -> b Source #

Given number of actions executed during some time, this function calculates how much actions were executed per second (on average).