mco_perfmon_set_options

Sets runtime configuration options for the Performance Monitor.

Prototype

    void mco_perfmon_set_options(/*IN*/ mco_perf_options_t *options);

Arguments

options
Pointer to a populated mco_perf_options_t structure containing the desired monitor settings. The structure must be initialized before calling this function.

Description

This function updates the current performance monitor options. It can be called at any time after mco_perfmon_init() to dynamically adjust monitoring behavior (e.g., pause/resume collection, change sampling interval).

Return Codes

void
This function does not return a value.

Example

    #define PERF_DATABASE_SEGMENT_SIZE (64 << 20)  /* 64 MB */

    int main(int argc, char* argv[])
    {
        MCO_RET rc;
        void *perf_memory;
        mco_perf_options_t options;

        perf_memory = malloc(PERF_DATABASE_SEGMENT_SIZE);
        if (!perf_memory) {
            /* handle allocation error */
        }

        rc = mco_perfmon_init(perf_memory, PERF_DATABASE_SEGMENT_SIZE);
        if (rc != MCO_S_OK) { /* handle error */ }

        /* Initialize options from the current settings */
        const mco_perf_options_t *current_opts = mco_perfmon_get_options();
        if (current_opts) {
            options = *current_opts;
        }

        /* Modify desired setting */
        options.enabled = 0;  /* temporarily disable monitoring */

        /* Apply updated options */
        mco_perfmon_set_options(&options);

        /* ... continue with application logic ... */

        rc = mco_perfmon_close();
        free(perf_memory);
        return 0;
    }

Files

Header file:
mcoperfmon.h
Source file:
mcoperf.c
Library:
libmcoperf.a