The constructor will instantiate this manager and determine if performance monitoring is enabled.
If the monitoring is enabled, it will also calculate the name of the global symbol. Also, if the global symbol has not been instantiated, this manager will be the default one and will be the one responsible for saving all data to the files.
A reference to the performance api that is managed by this specific manager.
A symbol to uniquely identify the _api in the NodeJS.Global symbol.
A boolean set by the constructor indicating if performance is enabled.
The unique identifier of this current package instance. This will be the
name@version
of the closest package.json relative to the location of the
first file that imported this package.
The environment variable that will be checked to determine if performance is enabled.
The value that the environment variable must be in order for performance gathering to be enabled.
Gets the _api.
NOTE:
It is recommended that calls to the getApi method are contained within an if check to see if performance is enabled. This method will provide the least overhead for when performance is disabled but will add a some overhead when performance is enabled.
NOTE:
If performance is not enabled, this method will still return a PerformanceApi object and all methods can still be called the same way with performance enabled or disabled. With this in mind, it is not required that calls to this method are wrapped in a check to see if this is enabled, but it is still recommended.
The performance api that is managed by this class.
Responsible for gathering and saving all metrics present within the environment.
This method is only called by process.on('exit')
defined in the constructor of the
main manager. The nodeTiming and systemInformation portions of the IPerformanceMetrics
object are gathered from the _api of this manager.
Metrics are gathered by examining each API present in the {@link NodeJS.global} object. This design comes from the fact that there could be multiple instances of the PerfTiming package due to how npm dependencies work. So the main manager can find out about all possible metrics and output them in a single file as opposed to each manager creating it's own file. It is because of this fact that the methods in IPerformanceApi must not change too often for compatibility reasons.
a promise of completion.
Generated using TypeDoc
The manager responsible for the PerformanceApi created by the current package instance.
NOTE:
This class is not intended to be instantiated directly. It should be accessed through the PerfTiming variable instantiated by this package. Failure to do so will result in lost metrics in the final file output.