vt::metrics::PerfData struct

Tracks performance metrics per task.

The PerfData component is responsible for initializing, tracking, and retrieving performance metrics for specific tasks using Linux performance counters.

Base classes

template<typename T>
struct vt::runtime::component::Component<PerfData>
Component class for a generic VT runtime module, CRTP'ed over the component's actual type

Constructors, destructors, conversion operators

PerfData()
Constructor for PerfData.
~PerfData() virtual
Destructor for PerfData.

Public functions

void startTaskMeasurement()
Start performance measurement for a task.
void stopTaskMeasurement()
Stop performance measurement for a task.
auto getTaskMeasurements() -> std::unordered_map<std::string, uint64_t>
Get the measurements collected during the task execution.
auto getEventMap() const -> std::unordered_map<std::string, std::pair<uint64_t, uint64_t>>
Retrieve the current event map.
void startup() override
Component startup method.
auto name() -> std::string override
Get the component name.
template<typename SerializerT>
void serialize(SerializerT& s)
Serialize the PerfData object.

Function documentation

vt::metrics::PerfData::PerfData()

Constructor for PerfData.

Initializes performance counters based on the VT_EVENTS environment variable, which is a comma seperated list of events available in the events header (example_events.h by default). For example: VT_EVENTS="cache-misses,instructions". If VT_EVENTS isn't set, will default to measuring instructions. Ensures only valid events are configured.

vt::metrics::PerfData::~PerfData() virtual

Destructor for PerfData.

Cleans up resources, closing file descriptors associated with performance counters.

void vt::metrics::PerfData::startTaskMeasurement()

Start performance measurement for a task.

Resets and enables the performance counters associated with the tracked events.

void vt::metrics::PerfData::stopTaskMeasurement()

Stop performance measurement for a task.

Disables the performance counters associated with the tracked events.

std::unordered_map<std::string, uint64_t> vt::metrics::PerfData::getTaskMeasurements()

Get the measurements collected during the task execution.

Returns A map of event names to their corresponding measurement values.
Exceptions
vtAbort if there is a mismatch in data or an error during reading.

Reads and retrieves the counter values for all tracked events.

std::unordered_map<std::string, std::pair<uint64_t, uint64_t>> vt::metrics::PerfData::getEventMap() const

Retrieve the current event map.

Returns A map of event names to pairs of event type and configuration values.

Returns the mapping of event names to their type and configuration values.

std::string vt::metrics::PerfData::name() override

Get the component name.

Returns The name of the component as a string.