Retrieve metadata (name and handle) for a registered runtime statistics counter.
MCO_RET mco_stat_get_counter_info(
/*IN*/ mco_stat_hdl counter,
/*OUT*/ mco_stat_counter_info_t *info
);
counter
0 to MCO_STATRT_TOTAL_COUNTERS - 1 or a valid custom counter handle).info
mco_stat_counter_info_t structure that will receive the counter's metadata:
handle — the same as the input counter,name — a null-terminated string with the counter's descriptive name.This function provides introspection into the runtime statistics system. It returns the human-readable name and handle of a given counter, which is essential for diagnostic tools, monitoring dashboards, or logging systems that need to map numeric counter indices to meaningful labels.
For built-in counters (e.g.,
MCO_STATRT_COMMIT_COUNT), the name is predefined. For custom counters registered viamco_statrt_register_counter(), the name is the one provided during registration.
MCO_S_OK
MCO_E_INVALID_HANDLE
mco_stat_counter_info_t info;
MCO_RET rc;
rc = mco_stat_get_counter_info(MCO_STATRT_COMMIT_COUNT, &info);
if (rc == MCO_S_OK) {
printf("Counter %d: %s\n", info.handle, info.name);
}