# mco_statrt_get
RT

> Retrieve the current value of a registered runtime statistics counter.

### Prototype

        mco_stat_counter_value mco_statrt_get(
            /*IN*/ mco_stat_hdl h
        );

### Arguments

`h`
Handle of the statistics counter to query. Must be a valid handle returned by `mco_statrt_register_counter()` or a built-in counter identifier (e.g., `MCO_STATRT_COMMIT_COUNT`).

### Description

> 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.

### Return Value

`mco_stat_counter_value`
Current value of the requested counter. If the handle is invalid or the statistics subsystem is not initialized, the return value is undefined.

### Example

        // Get the number of committed transactions
        mco_stat_counter_value commits = mco_statrt_get(MCO_STATRT_COMMIT_COUNT);
        printf("Committed transactions: %u\n", commits);

### Files

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