The Performance Monitor Python API is implemented in the
exdb.Perfmonclass.To enable performance monitoring in Python, first initialize the eXtremeDB runtime with
UsePerfmon=True:exdb.init_runtime(disk=is_disk, tmgr=options.tmgr, shm=is_shm, debug=is_debug, UsePerfmon=True)Next, initialize the monitor by specifying the size of the in-memory database used to store metrics:
exdb.Perfmon.init(perfmon_db_size)Then open the eXtremeDB database you wish to monitor and attach it to the performance monitor:
exdb.Perfmon.attach(db_name)Perform the database operations for which you want to collect performance metrics. When monitoring is complete, detach the database and shut down the monitor:
exdb.Perfmon.detach() exdb.Perfmon.close()At any time after initializing the monitor, you can configure its behavior using the following options:
enabledEnables or disables performance monitoring.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
exdb.Perfmon.get_options(), which returns an options structure. To update a setting, useexdb.Perfmon.set_options(option_name, value).After attaching a database, you can obtain the name of the currently monitored database at any time by calling
exdb.Perfmon.getDbName().