The Framework Measurement module provides a universal model for measuring important runtime parameters of bundles as well as of the framework itself, such as startup time, used memory and count of active threads.
The framework loads the Framework Measurement module only if one of the system properties for turning measuring on is true (refer to the Periodic Memory Measurement section below).
Measurement methods
Basically, the Framework Measurement module supports two ways of measurement:
Framework measurement features
Framework Measurement is represented by the com.prosyst.mbs.framework.measurement.FrameworkMeasurement interface.
Default Framework Measurement implementation prints the results to the standard output. It is able to perform memory measurements – presently only used heap memory measurements. It also provides information about the number of active threads, and performs periodic memory measurements (see the "Periodic Memory Measurement" section below).
Configuring measured parameters and their display
The Framework Measurement implementation accepts a number of system properties related to the parameters measured. For more information about measurement system properties, refer to the "System Properties" document.
Periodic memory measurement
The Framework Measurement module starts a thread, which periodically triggers measurement of consumed memory. The measurement period in minutes can be configured with the mbs.measurements.period system property. The default period is 10 minutes.
Setup
The operation of the Framework Measurement module in the framework can be configured by a number of system properties. These system properties must be specified in the command line or in the framework starting script as the framework loads the module prior to reading the content of its properties file (i.e. default.prs and common.prs by default).
The framework loads the Framework Measurement module only if one of the following system properties is set to true in the command line or in the framework starting script:
For more information about the full collection of measurement system properties, refer to the "System properties" document.
You can conveniently use the measurements option of the JVM-specific server script to start the OSGi Runtime with active Framework Measurements. For example, to start the OSGi Runtime on JDK, open a console in directory bin/vms/jdk and type:
server measurements
Refer to the "Starting the framework with measurements" section of the documentation for further information.
Custom framework measurement
If you want to develop a custom implementation of the Framework Measurement module, implement the interface, add the implementation class file to the classpath and set the mbs.measurements.class system property to the name of the implementation class.
Most common measurement types, that can be implemented in the trigger method, are provided as FrameworkMeasurement fields and can be optionally configured as system properties.