chronon::observe::ObservableUnit
#include <ObservableUnit.hpp>
Public Functions
| Name | |
|---|---|
| virtual | ~ObservableUnit() =default |
| template <FixedString Fmt,typename... Args> void | warn(Args &&... args) |
| template <FixedString Fmt,typename Cat ,typename... Args> void | tracePipe(Cat , const char * , Args && ...) |
| template <FixedString Fmt,typename Cat ,typename... Args> void | traceEvent(Cat , Args && ...) |
| void | traceCounter(const char * , int64_t ) |
| void | traceCounter(const char * , uint64_t ) |
| template <FixedString Fmt,typename Cat ,typename... Args> void | trace(Cat category, Args &&... args) |
| void | setObservationContext(ObservationContext * ctx) |
| void | registerDerivedCounter(DerivedCounter * dc) |
| void | registerCounter(Counter * counter) |
| const ObservationStats & | observeStats() const |
| ObservationContext * | observeCtx() |
| const ObservationContext * | observeCtx() const |
| const ObservationStats & | observationStats() const |
| ObservationContext * | observationContext() |
| const ObservationContext * | observationContext() const |
| bool | observabilityEnabled() const |
| template <FixedString Fmt,typename... Args> void | info(Args &&... args) |
| virtual uint64_t | getObserveCycle() const |
| template <FixedString Fmt,typename... Args> void | error(Args &&... args) |
| template <FixedString Fmt,typename... Args> void | debug(Args &&... args) |
| template <ObservationChannel Ch> const ObservationChannelStats & | channelStats() const |
Protected Attributes
| Name | |
|---|---|
| ObservationContext * | observe_ctx_ |
Detailed Description
class chronon::observe::ObservableUnit;
ObservableUnit - Mixin providing observability to simulation units.
Inherit from this class (in addition to Unit) to add observation capabilities.
Usage:
inline const auto CACHE_HIT = Category<"cache_hit", "Cache hit">{};
class MyUnit : public Unit, public ObservableUnit {
Counter ops_{this, "ops", "Operations executed"};
public:
void tick() override {
++ops_;
trace<"Hit at 0x{:x}">(CACHE_HIT, addr);
debug<"Processing cycle {}">(cycle);
}
};
Public Functions Documentation
function ~ObservableUnit
virtual ~ObservableUnit() =default
function warn
template <FixedString Fmt,
typename... Args>
inline void warn(
Args &&... args
)
Emit a warning log message.
function tracePipe
template <FixedString Fmt,
typename Cat ,
typename... Args>
inline void tracePipe(
Cat ,
const char * ,
Args && ...
)
function traceEvent
template <FixedString Fmt,
typename Cat ,
typename... Args>
inline void traceEvent(
Cat ,
Args && ...
)
function traceCounter
inline void traceCounter(
const char * ,
int64_t
)
function traceCounter
inline void traceCounter(
const char * ,
uint64_t
)
function trace
template <FixedString Fmt,
typename Cat ,
typename... Args>
inline void trace(
Cat category,
Args &&... args
)
Parameters:
- category Trace category
- args Format arguments
Template Parameters:
- Fmt Format string (compile-time)
Emit a trace event with compile-time format string.
Usage: trace<"I-Cache HIT: pc=0x{:x}">(ICACHE_HIT, pc);
function setObservationContext
inline void setObservationContext(
ObservationContext * ctx
)
Set the observation context.
Called by Simulation during unit initialization. Initializes all pending counters.
function registerDerivedCounter
inline void registerDerivedCounter(
DerivedCounter * dc
)
Register a derived counter for initialization when context is attached.
Called by DerivedCounter constructor.
function registerCounter
inline void registerCounter(
Counter * counter
)
Register a counter for initialization when context is attached.
Called by Counter constructor.
function observeStats
inline const ObservationStats & observeStats() const
function observeCtx
inline ObservationContext * observeCtx()
function observeCtx
inline const ObservationContext * observeCtx() const
function observationStats
inline const ObservationStats & observationStats() const
Get per-unit observation stats (emitted/dropped per channel).
function observationContext
inline ObservationContext * observationContext()
Get the observation context.
Returns nullptr if not set (observability disabled).
function observationContext
inline const ObservationContext * observationContext() const
function observabilityEnabled
inline bool observabilityEnabled() const
Check if observability is enabled.
function info
template <FixedString Fmt,
typename... Args>
inline void info(
Args &&... args
)
Emit an info log message.
function getObserveCycle
inline virtual uint64_t getObserveCycle() const
Get the current cycle for observation timestamps.
Override this in derived classes to return the unit's local cycle. Default returns 0.
function error
template <FixedString Fmt,
typename... Args>
inline void error(
Args &&... args
)
Emit an error log message.
function debug
template <FixedString Fmt,
typename... Args>
inline void debug(
Args &&... args
)
Emit a debug log message.
Usage: debug<"Processing request id={}">(request_id);
function channelStats
template <ObservationChannel Ch>
inline const ObservationChannelStats & channelStats() const
Get stats for a specific observation channel.
Protected Attributes Documentation
variable observe_ctx_
ObservationContext * observe_ctx_ = nullptr;
Updated on 2026-05-26 at 05:42:33 +0000