Retrieve the internal histogram index associated with a given statistics counter.
MCO_RET mco_stat_get_histogram_source(
/*IN*/ mco_stat_hdl counter,
/*OUT*/ mco_stat_hdl *source
);
counter
source
MCO_STAT_INVALID_HANDLE.This function maps a statistics counter to its corresponding histogram storage index. It is primarily used by diagnostic or monitoring tools that need to access raw histogram data via
mco_stat_histogram_get().Only counters registered with
collect_histogram = MCO_YES(viamco_statrt_register_counter()) have an associated histogram. For all other counters, this function returnsMCO_STAT_INVALID_HANDLEin thesourceparameter.Note: The statistics subsystem must be initialized (i.e., a database with statistics support must be open) before calling this function.
MCO_S_OK
source parameter contains the histogram index or MCO_STAT_INVALID_HANDLE.MCO_E_INVALID_HANDLE
mco_stat_hdl hist_idx;
MCO_RET rc;
rc = mco_stat_get_histogram_source(MCO_STATRT_MAX_TRANS_TIME, &hist_idx);
if (rc == MCO_S_OK && hist_idx != MCO_STAT_INVALID_HANDLE) {
mco_stat_histogram_h hist;
mco_stat_histogram_get(hist_idx, &hist);
printf("Histogram range: %u\n", hist->range);
}