Expand description
§gwr-track
gwr_track is the logging library used by the GWR engine and all components.
It can be used to generate either text-based or Cap’n Proto-based binary log
files.
§Entities
gwr_track provides the Entity struct. It is designed to represent a unique
simulation Entity/component which exists within the simulation hierarchy.
An Entity will have a unique location within the simulation hierarchy and are
each assigned a unique Id. For example:
top::processor0::cpu102::memoryTracing can be configured globally or enabled/disabled depending on regular expressions matching entity names.
§EntitiyMonitor
The EntityMonitor allows the user to create helper structs that can monitor an
Entity and emit useful statistics through track_value() calls.
§Objects
For short-lived parts of the simulations (like an Ethernet frame or a memory
access) the user can create a track object. These are given unique Ids like
Entities and Entities so that their lifecycle can be tracked across the
simulation.
§IDs
Each Entity will have a unique 64-bit Id. This ID is used throughout the
log/bin files in order to identify the originator of messages and to reduce the
size of the files.
Ids are also assigned to track Objects. Objects do not contain an
Entity because they flow through the simulation and so their location within
the simulation changes. However, the logging of packets is controlled by the
Entity that creates the object.
§Macros
The library provides a number of macros that provide the logging functionlity with a minimal run-time overhead when not enabled.
There are the macros that map to log messages of the specified level:
trace!- a message that will only be emitted if log level isTrace.debug!- a message that will only be emitted if log level isDebugor above.info!- a message that will only be emitted if log level isInfoor above.warn!- a message that will only be emitted if log level isWarnor above.error!- a message that will only be emitted if log level isErroror above.
Note: the logging level is controlled globally with the ability to configure
it at the level of any Entity within the simulation hierarchy.
Re-exports§
Modules§
- builder
- Library functions to build trackers as defined by the user.
- entity
- A simulation entity.
- gwr_
track_ capnp - Auto-generated Cap’n Proto module
- id
- Id
- perfetto_
trace_ builder - Support for generating Perfetto traces.
- test_
helpers - This module provides helper functions for testing logging output
- trace_
visitor - This module provides helper functions for dealing with Cap’n Proto binary data.
- tracker
- Include the trackers.
Define the
Tracktrait a number ofTrackers.
Macros§
- build_
aka - Helper function for creating local Aka derived from incoming Aka
- connect
- Connect two entities
- create_
id - Create a unique ID for tracking.
- debug
- The
debugmacro provides a wrapper for thelogmacro at levellog::Level::Debug - destroy
- Add an entity destroy event
- destroy_
id - Destroy an ID
- error
- the
errormacro provides a wrapper for thelogmacro at levellog::Level::Error - info
- The
infomacro provides a wrapper for thelogmacro at levellog::Level::Info - log_
base - Base macro for log messages of all level.
- set_
time - Update the current time.
- test_
init - Initialise the logging system for tests
- trace
- The
tracemacro provides a wrapper for thelogmacro at levellog::Level::Trace - track_
create_ object - Add an object creation event.
- warn
- The
warnmacro provides a wrapper for thelogmacro at levellog::Level::Info
Constants§
- NO_ID
- ID value which indicates where there is no valid ID
- ROOT
- The root ID from which all other IDs are derived
Functions§
- str_
to_ level - Take the command-line string and convert it to a Level
Type Aliases§
- Writer
- A type alias for objects that receive log / trace events.