Skip to main content

chronon::observe::ThreadContext

More...

#include <ThreadContext.hpp>

Public Functions

Name
SizeCacheVector &sizeCache()
SPSCQueue &queue()
const SPSCQueue &queue() const
ThreadContext &operator=(const ThreadContext & ) =delete
ThreadContext &operator=(ThreadContext && ) =delete
boolisActive() const
voidincrementDropped()
uint32_tid() const
uint64_tdroppedCount() const
ThreadContext(uint32_t id, size_t queue_capacity =SPSCQueue::DEFAULT_CAPACITY)
ThreadContext(const ThreadContext & ) =delete
ThreadContext(ThreadContext && ) =delete

Detailed Description

class chronon::observe::ThreadContext;

ThreadContext - Per-thread state for observability.

Each simulation thread that emits traces/logs gets its own ThreadContext with a dedicated SPSC queue. This eliminates mutex contention between threads.

A thread leases a context on first use and owns its producer state until exit. Storage stays in the manager's bounded pool; once the consumer has acknowledged the final records, another thread may lease the same slot.

Public Functions Documentation

function sizeCache

inline SizeCacheVector & sizeCache()

String length cache for two-phase encoding:

  1. Size calculation phase: compute and cache string lengths
  2. Encoding phase: use cached lengths (no redundant strlen)

function queue

inline SPSCQueue & queue()

function queue

inline const SPSCQueue & queue() const

function operator=

ThreadContext & operator=(
const ThreadContext &
) =delete

function operator=

ThreadContext & operator=(
ThreadContext &&
) =delete

function isActive

inline bool isActive() const

function incrementDropped

inline void incrementDropped()

function id

inline uint32_t id() const

function droppedCount

inline uint64_t droppedCount() const

function ThreadContext

inline explicit ThreadContext(
uint32_t id,
size_t queue_capacity =SPSCQueue::DEFAULT_CAPACITY
)

Parameters:

  • id Unique thread context ID (assigned by ThreadContextManager)
  • queue_capacity Capacity of the SPSC queue in bytes

Construct a thread context with the given ID.

function ThreadContext

ThreadContext(
const ThreadContext &
) =delete

function ThreadContext

ThreadContext(
ThreadContext &&
) =delete

Updated on 2026-09-20 at 14:23:39 +0000