IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo trait

TraceBuf

Trace-buffer interface. Implementations: NullTrace, GmemTrace.

Implemented traits​

AnyType, Copyable, Deinitable, DevicePassable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassable

Required methods​

store​

def store(self, offset: Int, val: UInt64)

Stores a timestamp at a slot in the trace buffer.

Args:

  • ​offset (Int): Slot index. Callers typically encode roles as block_idx * events_per_block + role.
  • ​val (UInt64): Timestamp value (ns from global_perf_counter_ns).

base_ptr​

def base_ptr(self) -> Pointer[UInt64, MutUntrackedOrigin]

Base pointer of the underlying slot buffer.

For handing the buffer to code that cannot accept a TraceBuf -- P3PeerSendConfig is a plain struct reaching the epilogue and the send warp class. NullTrace returns a DANGLING pointer, so every consumer must gate on its own runtime enable; a dangling pointer is not a valid "uninitialized" sentinel.

Returns:

Pointer[UInt64, MutUntrackedOrigin]

load​

def load(self, offset: Int) -> UInt64

Reads a u64 slot (the Section B ring WRITE_COUNT cursor).

Args:

  • ​offset (Int): Slot index.

Returns:

UInt64: The stored u64, or 0 for the no-op NullTrace.

Was this page helpful?