package cactus

  1. Overview
  2. Docs

This module exposes functions to produce statistics on function calls

type t
val v : counter_names:string list -> t

creates a handle for function call statistics. The optional argument can be used to create named additional internal counters to keep track, for instance, of the size of the inputs. Use to only use the default counter that keeps track of the number of function calls

val increment : t -> string -> int -> unit

incr t name n increments the named counter with name name of t by n units

val tic : t -> unit

Play the internal clock

val tac : t -> unit

tac t n pauses the internal clock of t. Must follow a tic.

val get_count : ?name:string -> t -> int

Number of tic-tacs if no name is provided, else the counter associated to name

val get_span : t -> Mtime.span

Total time taken by tic-tacs

val pp : t Fmt.t