Module Profiling.State

type debug_call =
  1. | Start_section of string
  2. | End_section of string

Kinds of special `write_debug` messages the profiler can handle. Messages are of the form `__wasm_debugger__::<debug_call>(<data>)`

type t = private {
  1. mutable call_stack : function_call call_stack * function_call call_stack list;
  2. mutable kernel_runs : function_call call_stack option list;
  3. mutable sections : (Z.t * string) list;
  4. mutable debug_call : debug_call option;
}

The profiling state is the internal state built by the profiler. It is defined as mutable as it is updated by side effects during the profiling.

val init : symbols:string Custom_section.FuncMap.t -> with_time:bool -> reveal_builtins:Mavryk_scoru_wasm.Builtins.reveals option -> write_debug:Mavryk_scoru_wasm.Builtins.write_debug option -> t * should_compute * Mavryk_scoru_wasm.Builtins.write_debug option

init ~symbols ~current_time initializes the profiler state and returns the instrumented `should_compute` function expected by the WASM PVM and the instrumented `write_debug` backend. This function updates the profiler state by side effects during the compilation.

val finalized_runs : t -> function_call call_stack option list