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

Public types

struct TaskGroupMeasurements

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 getTaskGroupMeasurements() -> std::vector<TaskGroupMeasurements>
Get grouped task measurements and raw perf multiplexing metadata.
auto getEventMap() const -> std::unordered_map<std::string, PerfEventDescriptor>
Retrieve the current event map.
auto getEventGroups() const -> std::vector<PerfEventGroupInfo>
Retrieve resolved event grouping metadata.
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 separated list of events available in the events header (example_events.h by default). Explicit groups may be provided with braces, such as VT_EVENTS="{instructions,cycles},cache_misses". Append ! to an event or explicit group to pin that group, such as VT_EVENTS="instructions!,{cycles,cache_misses}!". If VT_PERF_AUTO_GROUP is enabled, ungrouped events are bucketed using the descriptors from example_events.h. 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::vector<TaskGroupMeasurements> vt::metrics::PerfData::getTaskGroupMeasurements()

Get grouped task measurements and raw perf multiplexing metadata.

Reads grouped counter values along with the raw time_enabled and time_running values returned by the perf subsystem.

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

Retrieve the current event map.

Returns A map of event names to their performance event descriptors.

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

std::vector<PerfEventGroupInfo> vt::metrics::PerfData::getEventGroups() const

Retrieve resolved event grouping metadata.

Returns the final event groups after explicit parsing and optional auto-group resolution.

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

Get the component name.

Returns The name of the component as a string.