Module Default.Time_measurement

Default implementation of the Time_measurement.S interface.

val duration : Measurement.key -> (unit -> 'a) -> 'a

duration key thunk mesures the time taken to run the given thunk, binds the resulting time measurement with the given key and stores it in the batch. It will then evaluate in the result of the thunk.

val duration_lwt : Measurement.key -> (unit -> 'a Lwt.t) -> 'a Lwt.t

Same as duration, but waits for the thunk's resulting promise to be resolved in order to properly measure time when using Lwt.

val timestamp_pre : Measurement.key -> (unit -> 'a) -> 'a

timestamp_pre key thunk mesures the current time, binds the resulting time measurement with the given key and stores it in the batch. It will then execute the given thunk and evaluates in its result.

val flush : unit -> unit Lwt.t

flush () cleans the batch and emits an event log that will display all measured times collected within the batch.