Async.TraceTracing asynchronous function activity.
type exec_id = {thread_id : thread_id;Thread identifier to which the trace is attributed to. Normally, the thread that executes report.
sup : domain_id;Identifier of a "supervising" domain for thread_id. If index is
< 0, this is the domain in which thread_id runs.= 0, this is the domain identifier of a scheduler main domain and thread_id is the main thread of that main scheduler domain.> 0, this is the domain identifier of a scheduler main domain and thread_id is the main thread of a worker domain spawned by the main domain and indexed by index in the scheduler.index : int;}The type for execution context identifiers. Basically thread identifiers with more metadata to make scheduler traces more lightweight but without confusions if multiple schedulers or external entities are also running.
val current_thread_id : unit -> thread_idcurrent_thread_id () captures the thread identifier of the caller.
val current_exec_id : unit -> exec_idcurrent_exec_id () captures the execution context of the caller. It has the current thread and domain id and index is -1.
Warning. If you call that in an asynchronous function it will not capture its scheduler. This is meant to be used by external scheduler entities that want to trace.
type payload = | Action_block of Call.id * Action.Private.Action.Meta.t| Action_unblock of Call.id * Action.Private.Action.Meta.t| Async_fun_call of {}| Async_fun_continue of Call.idReported when a function continues its execution after it was called, yielded or blocked.
*)| Async_fun_yield of Call.id| Async_fun_return of Call.idReported when an asynchronous function returns.
*)| Async_fun_user of Call.id * string| Domain_startReported when domain starts its local scheduler.
*)| Domain_sleepReported when a domain starts sleeping.
*)| Domain_unblocker of {}Reported when a domain executes an unblocker.
*)| Domain_resumeReported when a domain returns from sleep or the unblocker
*)| Domain_panic of stringReported when a domain has an internal scheduler error.
*)| Domain_stopReported when a domain stops its local scheduler.
*)The type for trace payloads.
val is_domain : t -> boolis_domain t is true iff the trace t only pertains to the life cycle of domains.
val is_fun : t -> boolis_fun t is not (is_domain t) and true iff the trace t only pertains to asynchronous function activity or actions.
val is_user : t -> boolis_user t is true iff t is Async_fun_user, that is the calls to Fun.Async.trace.
type reporter = t -> unitThe type for reporters.
val default_reporter : reporterdefault_reporter is the default reporter (Stdlib.ignore).
val format_reporter : (unit -> Stdlib.Format.formatter) -> reporterformat_reporter ppf is a reporter using a synchronization safe formater ppf (see Format.get_std_formatter) and pp to report.
val stderr_reporter : reporterstderr_reporter is format_reporter (Format.get_err_formatter).
val reporter : unit -> reporterreporter is the current reporter.
val set_reporter : reporter -> unitset_reporter reporter sets the current reporter to reporter
exchange_reporter r sets the current reporter r and returns the previous reporter.
val with_reporter : reporter -> (unit -> 'a) -> 'awith_reporter r f executes f () with current reporter r and restores the previous reporter after f returns or raises.
Warning. There is no notion of scope here, the reporter is a global variable. If someone set_reporter in parallel while in f it will be seen by f.
keep sat reporter reports with reporter but only those sat satisfying trace are given to it.
module Delayed : sig ... endDelayed reporters.
val pp_exec_id : Stdlib.Format.formatter -> exec_id -> unitpp_exec_id formats execution context identifiers for inspection.
val pp_exec_trace : Stdlib.Format.formatter -> exec_id -> unitpp_exec_trace formats a header for execution contexts.
pp_fun_trace is like pp_exec_trace but the trace also mentions the given call identifier.
val pp : Stdlib.Format.formatter -> t -> unitpp formats a trace.