Detaches a database from performance monitoring.
MCO_RET mco_perfmon_detach(/*IN*/ const char *dbName);
dbName
mco_perfmon_attach().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.
MCO_S_OK
MCO_E_PERFMON_NOT_INITIALIZED
mco_perfmon_init() first.
#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;
}