package catapult

  1. Overview
  2. Docs

Module Catapult.TracingSource

Profiling probes.

This is the main API. The user can insert probes into their code, and at runtime, these probes will use the Backend (if present) to emit tracing events to be replayed later. If no backend is present, the probes will do nothing.

Sourcetype backend = (module Catapult__.Backend.S)
Sourcetype arg = [
  1. | `Int of int
  2. | `String of string
  3. | `Float of float
  4. | `Bool of bool
  5. | `Null
]
Sourcetype 'a emit_fun_base = ?pid:int -> ?tid:int -> ?args:(string * arg) list -> string -> 'a

Emitter function, without timestamp. See emit_fun for more details.

Sourcetype 'a with_cat = ?cat:string list -> 'a
Sourcetype 'a with_ts_us = ?ts_us:float -> 'a
Sourcetype 'a with_stack = ?stack:string list -> 'a

Function that can take a stack trace

An emitter function. The positional string argument is the name.

  • parameter cat

    list of categories for filtering the event

  • parameter pid

    the process ID

  • parameter tid

    the thread ID

  • parameter arguments

    list of arguments for the event, with a name for each

  • parameter ts_us

    timestamp in microseconds

  • parameter name

    the name of this event

Sourcetype span_start

Represents the beginning of a span, to emit compact spans

Sourceval null_span : span_start
Sourceval enabled : unit -> bool

Is tracing enabled?

Sourceval emit : (?dur:float -> Event_type.t -> unit) emit_fun with_stack

Emit a generic event.

Sourceval begin_ : unit -> span_start

Emit a "X" event with duration computed from the given span start

Sourceval with_ : ((unit -> 'a) -> 'a) emit_fun_base with_cat
Sourceval with1 : (('a -> 'b) -> 'a -> 'b) emit_fun_base with_cat
Sourceval with2 : (('a -> 'b -> 'c) -> 'a -> 'b -> 'c) emit_fun_base with_cat
Sourceval with3 : (('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> 'd) emit_fun_base with_cat
Sourceval begin' : unit emit_fun with_stack

Emit a "B" event

Sourceval exit' : unit emit_fun with_stack

Emit a "E" event

Sourceval span : (dur:float -> unit) emit_fun with_stack

Emit a "X" event

Sourceval obj_new : (id:string -> unit) emit_fun with_stack
Sourceval obj_snap : (snapshot:string -> id:string -> unit) emit_fun with_stack
Sourceval obj_delete : (id:string -> unit) emit_fun with_stack
Sourceval obj_with : (id:string -> (unit -> 'a) -> 'a) emit_fun
Sourceval obj_with1 : (id:string -> ('a -> 'b) -> 'a -> 'b) emit_fun
Sourceval a_begin : (cat:string list -> id:string -> unit) emit_fun_base with_ts_us
Sourceval a_exit : (cat:string list -> id:string -> unit) emit_fun_base with_ts_us
Sourceval a_snap : (cat:string list -> id:string -> unit) emit_fun_base with_ts_us
Sourceval a_with : (cat:string list -> id:string -> (unit -> 'a) -> 'a) emit_fun_base with_ts_us
Sourceval a_with1 : (cat:string list -> id:string -> ('a -> 'b) -> 'a -> 'b) emit_fun_base with_ts_us
Sourceval f_begin : (id:string -> unit) emit_fun
Sourceval f_exit : (id:string -> unit) emit_fun
Sourceval f_step : (id:string -> unit) emit_fun
Sourceval instant : unit emit_fun with_stack
Sourceval counter : (cs:(string * int) list -> unit) emit_fun
Sourceval meta_thread_name : string -> unit
Sourceval meta_process_name : string -> unit
Sourceval tick : unit -> unit

Depending on the tracing backend, this needs to be called regularly to ensure background work is done.

Sourcemodule Syntax : sig ... end
include module type of Syntax
Sourceval (let@) : ('a -> 'b) -> 'a -> 'b
Sourcemodule Control : sig ... end

Controls the current backend.

OCaml

Innovation. Community. Security.