mco_stat_counter_count

Retrieve the total number of registered runtime statistics counters and histograms.

Prototype

    MCO_RET mco_stat_counter_count(
        /*OUT*/ mco_stat_hdl *ncounters,
        /*OUT*/ mco_stat_hdl *nhist
    );

Arguments

ncounters
Pointer to a variable that will receive the total number of registered statistics counters.
nhist
Pointer to a variable that will receive the number of counters that have histogram collection enabled.

Description

This function returns metadata about the current runtime statistics configuration. It is typically used by monitoring tools or diagnostic interfaces to determine how many counters are available for querying via functions like mco_stat_counter_get() or mco_stat_get_counter_info().

The values reflect the state after all calls to mco_statrt_register_counter() have been made and the database runtime has been initialized. The counters are global to the process and shared across all database connections.

Note: This function can only be called after the statistics subsystem has been initialized (i.e., after a database with statistics support has been opened).

Return Codes

MCO_S_OK
Counter counts successfully retrieved.
MCO_E_INVALID_HANDLE
Statistics subsystem is not initialized (no database with statistics support is open).

Files

Header file:
mcostatrt.h
Source file:
mcostat.c
Library:
libmcolib.a