mco_perfmon_detach

Detaches a database from performance monitoring.

Prototype

    MCO_RET mco_perfmon_detach(/*IN*/ const char *dbName);

Arguments

dbName
Name of the database to detach from monitoring. The database must have been previously attached using mco_perfmon_attach().

Description

This function stops collecting performance metrics for the specified database and removes it from the Performance Monitor.

The database remains open and usable; only metric collection is disabled.

Return Codes

MCO_S_OK
Database successfully detached from monitoring.
MCO_E_PERFMON_NOT_INITIALIZED
Performance Monitor has not been initialized. Call mco_perfmon_init() first.

Example

    #define PERF_DATABASE_SEGMENT_SIZE (64 << 20)  /* 64 MB */
    const char* dbName = "SimpleDb";

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

        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 */ }

        rc = mco_perfmon_attach(dbName);
        if (rc != MCO_S_OK) { /* handle error */ }

        rc = mco_db_connect(dbName, &db);
        if (rc != MCO_S_OK) { /* handle error */ }

        /* ... perform monitored operations ... */

        rc = mco_db_disconnect(db);
        if (rc != MCO_S_OK) { /* handle error */ }

        rc = mco_perfmon_detach(dbName);
        if (rc != MCO_S_OK) { /* handle error */ }

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

Files

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