Retrieve the current value of a registered runtime statistics counter.
mco_stat_counter_value mco_statrt_get(
/*IN*/ mco_stat_hdl h
);
h
mco_statrt_register_counter() or
a built-in counter identifier (e.g., MCO_STATRT_COMMIT_COUNT).This function returns the current value of the specified runtime statistics counter. Counters track various database metrics such as transaction counts, error rates, timing data, and other performance indicators.
The value is read from the global statistics storage associated with the default database instance. The function does not reset the counter — it only performs a read operation.
Note: The statistics subsystem must be initialized (i.e., a database with statistics support must be open) before calling this function. If the handle is invalid or the subsystem is not ready, the behavior is undefined (in practice, the function may return 0 or an error code cast to
mco_stat_counter_value).For safe usage with error checking, consider using
mco_stat_counter_get(), which returns an explicit status code.
mco_stat_counter_value
// Get the number of committed transactions
mco_stat_counter_value commits = mco_statrt_get(MCO_STATRT_COMMIT_COUNT);
printf("Committed transactions: %u\n", commits);