The Performance Monitor C API provides a set of functions for integrating runtime performance monitoring into an application. The typical workflow involves:
- Initializing the monitor by allocating memory for the internal
perfmondatabase and passing the memory segment tomco_perfmon_init().- Attaching an eXtremeDB database to be monitored via
mco_perfmon_attach().- Performing database operations while metrics are collected.
- Detaching the database with
mco_perfmon_detach()and shutting down the monitor usingmco_perfmon_close().At any time after initialization, the application can configure monitor behavior using the following options:
enabledEnables or disables metric collection.0= disabled,1= enabled (default:1).monitor_interval_msSampling interval for metric collection, in milliseconds (default:1000ms = 1 second).store_interval_secRetention period for metrics in the perfmon database, in seconds (default:3600s). Older records are automatically purged to conserve space.To retrieve the current configuration, call
mco_perfmon_get_options(), which returns an options structure. To update settings, modify the structure and pass it tomco_perfmon_set_options().After attaching a database, the name of the internal perfmon database (where metrics are stored) can be obtained at any time by calling
mco_perfmon_get_db_name().