Module trace

Module trace 

Source
Expand description

Host-I/O trace buffer for debug_traceTransaction on Stylus programs.

Host functions call record to push a trace entry; a tracing driver installs a buffer via enable before running the program and takes the records afterwards.

Structs§

HostioRecord
Single recorded host-I/O call.

Functions§

disable
Clear the active buffer for the current thread.
enable
Install a buffer for the current thread. Subsequent record calls append to it until disable is called.
enter_subcall
Push a fresh sub-call frame. Subsequent record calls (until the matching exit_subcall) accumulate inside this frame.
exit_subcall
Pop the top sub-call frame and return its accumulated records. The parent CALL/CREATE hostio attaches this list as its steps.
is_active
Whether tracing is active on the current thread — cheap check the host functions can use to avoid building args/outs when disabled.
record
Push one record into the active buffer (or the open sub-frame, if any). A no-op when tracing is disabled — zero cost on the hot path.
record_ink
Record a host-function call with an ink delta captured by the caller. Used where args/outs aren’t meaningful but ink cost is.
record_leaf
Convenience wrapper for host functions that want to record the call name with optional args + outs and no ink delta (e.g., leaf host functions that never block or touch state).
record_with_steps
Like record but with pre-collected sub-frame records attached as steps (used by CALL/CREATE family hostios after popping their own sub-frame).
take
Take and clear the active buffer’s contents.