package b0

  1. Overview
  2. Docs

Measuring time.

Support to measure monotonic wall-clock time, CPU user and CPU system time.

Monotonic time spans

type span

The type for non-negative monotonic time spans. They represent the difference between two clock readings with nanosecond precision (1e-9s).

module Span : sig ... end

Time spans

Monotonic wall-clock time counters

type counter

The type for monotonic wall-clock time counters.

val counter : unit -> counter

counter () is a counter counting from now on.

val count : counter -> span

count c is the monotonic time span elapsed since c was created.

CPU time spans

type cpu_span

The type for CPU execution time spans.

val cpu_span : cpu_utime:span -> cpu_stime:span -> cpu_children_utime:span -> cpu_children_stime:span -> cpu_span

cpu_span ~cpu_utime ~cpu_stime ~cpu_children_utime ~cpu_children_stime is a cpu span with the given fields. See accessors for semantics.

val cpu_zero : cpu_span

cpu_zero is zero CPU times.

val cpu_utime : cpu_span -> span

cpu_utime_s cpu is cpu's user time in seconds.

val cpu_stime : cpu_span -> span

cpu_stime_s cpu is cpu's system time in seconds.

val cpu_children_utime : cpu_span -> span

cpu_utime_s cpu is cpu's user time in seconds for children processes.

val cpu_children_stime : cpu_span -> span

cpu_utime_s cpu is cpu's system time in seconds for children processes.

CPU time counters

type cpu_counter

The type for CPU time counters.

val cpu_counter : unit -> cpu_counter

cpu_counter () is a counter counting from now on.

val cpu_count : cpu_counter -> cpu_span

cpu_count c are CPU times since c was created.