Header menu logo issie

TimeHelpers Module

Types

Type Description

AggregatedData

InstrumentationControl

controls how time intervals are collected and displayed

Stats

Functions and values

Function or value Description

addTimeToStats t st

Full Usage: addTimeToStats t st

Parameters:
Returns: Stats

add time t to st

t : float
st : Stats
Returns: Stats

aggregate printInterval

Full Usage: aggregate printInterval

Parameters:
    printInterval : float

Returns: InstrumentationControl

initialse instrumentation parameter for aggregate time printing

printInterval : float
Returns: InstrumentationControl

checkPerformance m n startTimer stopTimer

Full Usage: checkPerformance m n startTimer stopTimer

Parameters:
    m : int
    n : int
    startTimer : string -> unit
    stopTimer : string -> unit

m : int
n : int
startTimer : string -> unit
stopTimer : string -> unit

executionStats

Full Usage: executionStats

Returns: Map<string, Stats>

execution time stats indexed by name in recordExecutionStats

Returns: Map<string, Stats>

getInterval startTime

Full Usage: getInterval startTime

Parameters:
    startTime : float

Returns: float
startTime : float
Returns: float

getTimeMs ()

Full Usage: getTimeMs ()

Parameters:
    () : unit

Returns: float

returns absolute time in ms, works under both .Net and Fable

() : unit
Returns: float

getTimeOfInMs limitMs thunk

Full Usage: getTimeOfInMs limitMs thunk

Parameters:
Returns: float

Return time taken by thunk() Run thunk() as many times as is needed for total elapsed time in ms to be > limitMs. Return average time of all runs. To minimise cache effects run thunk() once before starting to time.

limitMs : float
thunk : Unit -> Unit
Returns: float

immediate threshold updateThreshold

Full Usage: immediate threshold updateThreshold

Parameters:
    threshold : float
    updateThreshold : float

Returns: InstrumentationControl

initialise instrumentation parameter for immediate time printing

threshold : float
updateThreshold : float
Returns: InstrumentationControl

instrumentFunctionCall name func arg

Full Usage: instrumentFunctionCall name func arg

Parameters:
    name : string
    func : 'a -> float
    arg : 'a

Returns: 'b -> 'b

Record the elapsed time taken in execution of (func arg). Return the result from (func arg).

name : string
func : 'a -> float
arg : 'a
Returns: 'b -> 'b

instrumentInterval name startTime output

Full Usage: instrumentInterval name startTime output

Parameters:
    name : string
    startTime : float
    output : 'a

Returns: 'a

This function with its first two args should be put in a pipe after the code to be timed. it will return its piped input, with the side effect of recording the time delay in the function. Parameter start must be defined at the start of the code to be timed using getTimeMs.

name : string
startTime : float
output : 'a
Returns: 'a

instrumentTime intervalName intervalStartTime

Full Usage: instrumentTime intervalName intervalStartTime

Parameters:
    intervalName : string
    intervalStartTime : float

According to current settings, process and/or print a named time interval. the interval is between intervalStartTime passed as arg 2, and the time at which this function is called (all times obtained using getTimeMs).

intervalName : string
intervalStartTime : float

instrumentation

Full Usage: instrumentation

Returns: InstrumentationControl

Parameter that controls how recorded times are processed.

Returns: InstrumentationControl

performanceNow ()

Full Usage: performanceNow ()

Parameters:
    () : unit

Returns: float
() : unit
Returns: float

printAgg agg

Full Usage: printAgg agg

Parameters:
Returns: AggregatedData

print out the current aggregate of recorded times if this is requried. Return initialised aggregate totals after print

agg : AggregatedData
Returns: AggregatedData

printStats ()

Full Usage: printStats ()

Parameters:
    () : unit

print

() : unit

recordExecutionTimeStats name f arg

Full Usage: recordExecutionTimeStats name f arg

Parameters:
    name : string
    f : 'a -> 'b
    arg : 'a

Returns: 'b

Run (f arg) recording its time in executionStats under name. NB - this will run f multiple times if needed to estimate average speed more accurately. If an execution time of 5ms for this function is too long reduce timeLimit. The multiple time execution will not work, and will give lower than real results, if f is memoised. In that case set timeLimit to 0. for only one execution.

name : string
f : 'a -> 'b
arg : 'a
Returns: 'b

timeNowInMS ()

Full Usage: timeNowInMS ()

Parameters:
    () : unit

Returns: float
() : unit
Returns: float

timeNowInMicroS ()

Full Usage: timeNowInMicroS ()

Parameters:
    () : unit

Returns: float
() : unit
Returns: float

updateAgg name time agg

Full Usage: updateAgg name time agg

Parameters:
Returns: AggregatedData

process a new time interval updating the aggregated data for future printout

name : string
time : float
agg : AggregatedData
Returns: AggregatedData

Type something to start searching.