mco_stat_histogram_init

Initialize a statistics histogram structure to its default state.

Prototype

    void mco_stat_histogram_init(
        /*IN*/ mco_stat_histogram_h hist
    );

Arguments

hist
Pointer to a mco_stat_histogram_t structure to initialize.

Description

This function initializes a histogram structure by setting its range to the default value (MCO_STAT_HISTOGRAM_DEFAULT_RANGE, typically 100) and clearing all histogram bins (bars) to zero.

It must be called before using the histogram with mco_stat_histogram_append() or storing it in the statistics subsystem. This function is also used internally to reset histograms when statistics are cleared via functions l ike mco_stat_get_conn_stats(..., reset = MCO_YES).

Return Value

None
This function does not return a value.

Example

    mco_stat_histogram_t my_hist;

    // Initialize the histogram
    mco_stat_histogram_init(&my_hist);

    // Now it's safe to append values
    mco_stat_histogram_append(&my_hist, 42);
    mco_stat_histogram_append(&my_hist, 150);

Files

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