Metrics Export Data Experimental Extension

Metrics Export Data Experimental Extension

Sample Code

The following code shows how to export metrics raw data for a metric group.

// Get size for export data
size_t exportDataSize = 0;
zetMetricGroupGetExportDataExp(hMetricGroup, rawData, rawDataSize, &exportDataSize, nullptr);

// Allocate buffer for export data
uint8_t* pExportData = malloc(exportDataSize);

// Retrieve export data
zetMetricGroupGetExportDataExp(hMetricGroup, rawData, rawDataSize, &exportDataSize, pExportData);

The following code shows how to perform metrics calculation of collected data, which can be done in a different system than where data was collected.

// Get data count and total metric count
zet_metric_group_calculation_type_t type = ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES;
zet_metric_calculate_exp_desc_t calculateDesc;
calculateDesc.rawReportSkipCount = 0;
zetMetricGroupCalculateMetricExportDataExp(hDriver, type, exportDataSize, pExportData, &calculateDesc, &dataCount, &totalMetricCount, nullptr, nullptr);

void* pMetricCounts = malloc(dataCount * sizeof(uint32_t));
void* pMetricValues = malloc(totalMetricCount * sizeof(zet_typed_value_t));

// Get metric counts and metric values
zetMetricGroupCalculateMetricExportDataExp(hDriver, type, exportDataSize, pExportData, &calculateDesc, &dataCount, &totalMetricCount, pMetricCounts, pMetricValues);