[#BloombergLP-balb-PerformanceMonitor]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balb.adoc[balb]::PerformanceMonitor
:relfileprefix: ../../
:mrdocs:

Provides a mechanism to collect performance statistics for an arbitrary number of processes running on the local machine&period;

== Synopsis

Declared in `&lt;balb&lowbar;performancemonitor&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class PerformanceMonitor;
----

== Types

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/balb/PerformanceMonitor/ConstIterator.adoc[`ConstIterator`] 
| Provide a mechanism that models the &quot;Forward Iterator&quot; concept over a collection of non&hyphen;modifiable performance statistics&period;
| xref:BloombergLP/balb/PerformanceMonitor/Statistics.adoc[`Statistics`] 
| Defines the performance statistics collected for a monitored process&period; Note that this class is not fully value&hyphen;semantic&period; It is intended to provide a read&hyphen;only view of a set of collected performance statistics&period;
|===


== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/balb/PerformanceMonitor/Measure.adoc[`Measure`] 
| Enumerates the set of performance measures this class is capable of monitoring&period; Note that CPU utilization measures are calculated as a ratio of CPU time to elapsed time between two consecutive calls to `collect`, and therefore no value will be available if `collect` has been called only once&period; Note that not all measures are supported on all platforms&semi; for an unsupported measure, the behavior is as if the system reports a zero value&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/balb/PerformanceMonitor/2constructor-0f.adoc[`PerformanceMonitor`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/balb/PerformanceMonitor/2destructor.adoc[`&#126;PerformanceMonitor`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/balb/PerformanceMonitor/begin.adoc[`begin`] 
| Return an iterator positioned at the first set of collected performance statistics&period;
| xref:BloombergLP/balb/PerformanceMonitor/collect.adoc[`collect`] 
| Collect performance statistics for each registered pid&period;
| xref:BloombergLP/balb/PerformanceMonitor/end.adoc[`end`] 
| Return an iterator that represents the end of the sequence of sets of collected performance statistics&period;
| xref:BloombergLP/balb/PerformanceMonitor/find.adoc[`find`] 
| Return the iterator pointing to the set of collected performance statistics for the specified `pid` if `pid` has been registered with this performance monitor through the `registerPid` function, otherwise return `end()`&period; A `pid` value of zero is translated to the current process id&period;
| xref:BloombergLP/balb/PerformanceMonitor/numRegisteredPids.adoc[`numRegisteredPids`] 
| Return the number of processes registered for statistics collection&period;
| xref:BloombergLP/balb/PerformanceMonitor/registerPid.adoc[`registerPid`] 
| Register the specified process `pid` having the specified user&hyphen;defined `description` with this performance monitor&period; After registration, performance statistics will be collected for the `pid` upon invocation of the `collect` function&period; A `pid` value of zero is translated to the current process id&period; Return 0 on success or a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/balb/PerformanceMonitor/resetStatistics.adoc[`resetStatistics`] 
| Reset the collected min, max, and average values collected for each measure for each monitored process&period; Note that this method will call `collect` once for each monitored process, so the statistics after this method returns will be based on the values collected thereby&period;
| xref:BloombergLP/balb/PerformanceMonitor/setCollectionInterval.adoc[`setCollectionInterval`] 
| Set the specified time `interval`, in seconds, after which statistics for each registered pid are automatically collected&period; The behavior is undefined unless a scheduler was supplied at the construction of this performance monitor&period; A non&hyphen;positive `interval` value indicates that performance statistics should not be automatically collected&hyphen;&hyphen;in this case the user is responsible for manually calling the `collect` function&period;
| xref:BloombergLP/balb/PerformanceMonitor/unregisterPid.adoc[`unregisterPid`] 
| Unregister the specified process `pid` from the performance monitor&period; After unregistration, to statistics for the `pid` will be no longer be available unless the `pid` is re&hyphen;registered with the performance monitor through calling `registerPid`&period; A `pid` value of zero is translated to the current process id&period; Return 0 on success or a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/balb/PerformanceMonitor/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;PerformanceMonitor, UsesBslmaAllocator&gt;`] 
| Declare that this type uses a `bslma` allocator&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/balb/PerformanceMonitor/ConstIterator.adoc[BloombergLP::balb::PerformanceMonitor::ConstIterator]`
| Provide a mechanism that models the &quot;Forward Iterator&quot; concept over a collection of non&hyphen;modifiable performance statistics&period;
| `xref:BloombergLP/balb/PerformanceMonitor/Statistics.adoc[BloombergLP::balb::PerformanceMonitor::Statistics]`
| Defines the performance statistics collected for a monitored process&period; Note that this class is not fully value&hyphen;semantic&period; It is intended to provide a read&hyphen;only view of a set of collected performance statistics&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
