Module Perf
Global CPU instruction counter.
val init : unit -> unit
init ()
initialises, resets to 0, and starts the instruction counter. In case of an error, theFailure
exception is raised, and the counter state is fully re-initialised so thatinit
may be called again. Initialization is required prior to calling thedrop
andpeek
functions.
val drop : unit -> unit
drop ()
undoes the effect ofinit
, and frees all resources used by the internal state of the instruction counter. Note that the counter must have been initialised before callingdrop
, otherwiseFailure
is raised.
val peek : unit -> Stdlib.Int64.t
peek ()
reads the value of the instruction counter, which corresponds to the number of instructions run by the CPU since the last (successful) call toinit
. Note thatFailure
is raised in case of an error, including if the function is called while the counter is not initialised.