NS.Timer
Timers for runtime statistics
val create :
?at_exit:
(name:string -> elapsed:float -> aggregate:float -> count:int -> unit) ->
string ->
t
Construct a timer with the given name and register the given function to run at exit. The at_exit
function receives name
: the name of the timer passed to create
, elapsed
: the number of milliseconds between the longest single start
-stop
pair, aggregate
: the sum of the time that elapsed while the named timer was running, count
: the number of times stop
was called on the timer.
val start : t -> unit
Start a timer.
val stop : t -> unit
Stop a timer.
val stop_report :
t ->
(name:string -> elapsed:float -> aggregate:float -> count:int -> unit) ->
unit
Stop a timer and report using the given function, which receives name
: the name of the timer passed to create
, elapsed
: the number of milliseconds since start
was called, aggregate
: the sum of the time that has elapsed while the timer was running, count
: the number of times stop
has been called on the timer.