Module MemtraceSource

Sourceval trace_if_requested : ?if_started:[ `Fail | `Ignore ] -> ?context:string -> ?sampling_rate:float -> unit -> unit

If the MEMTRACE environment variable is set, begin tracing to the file it specifies, and continue tracing until the process exits.

The context is an arbitrary string, which is logged in the trace. It may be useful to identify trace files.

The sampling_rate is the proportion of allocated words that should be sampled. Values larger than about 1e-4 will have some performance impact. The sampling rate can also be specified with the MEMTRACE_RATE environment variable. If both means are used, the env var takes precedence.

May raise Unix.Unix_error if the specified file cannot be opened, or Invalid_argument if the MEMTRACE_RATE parameter is ill-formed.

May call failwith if memtrace was already started and if_started is `Fail.

Sourceval start_tracing : context:string option -> sampling_rate:float -> filename:string -> unit @@ portable

Manually start tracing.

Sourceval stop_tracing : unit -> unit @@ portable

Manually stop tracing.

This function does nothing if tracing is not in progress.

Sourceval currently_tracing : unit -> bool @@ portable

Is there an active trace running at the moment?

Sourceval default_sampling_rate : float @@ portable
Sourcemodule Trace : sig ... end

Use the Trace module to read and write trace files

Sourcemodule Memprof_tracer : sig ... end

Use Memprof_tracer in conjunction with Trace.Writer for more manual control over trace collection

Sourcemodule External : sig ... end

Use External to track non-GC-heap allocations in a Memtrace trace

Sourcetype tracer = unit

Memtrace has a global singleton tracer, and this type is defined purely for compatibility

Sourcemodule Geometric_sampler : sig ... end

(For testing)