Class MemoryPeak
Metric reporting the peak memory usage observed while a benchmark iteration is running.More...
#include <bench_memory_peak.h>
Inherits the following classes: Metric
Public Functions
| Type | Name |
|---|---|
| MemoryPeak () Construct the metric with label "MemoryPeak(Mo)". |
|
| virtual void | compute (const Mesh & mesh, const Mesh & reconstructed, benchmark::State & state) override const Record the collected peak on the benchmark state. |
| double | get_memory_usage_mo () Read the current resident memory of the process in MiB. |
| void | start () Start the background sampling thread. |
| void | stop () Stop the background sampling thread and wait for it to finish. |
| ~MemoryPeak () = default |
Public Functions inherited from Metric
See Metric
| Type | Name |
|---|---|
| Metric (const std::string & name) Construct a metric with the given short label. |
|
| virtual void | compute (const Mesh & originalMesh, const Mesh & reconstructedMesh, benchmark::State & state) const = 0 Compute the metric for a single (original, reconstructed) pair. |
| const std::string & | getName () const Return the metric's short label. |
| virtual | ~Metric () = default |
Detailed Description
The peak is collected in a background thread that periodically samples the process resident-set size (Linux: /proc/self/status, Windows: PSAPI) between start() and stop(). The highest sample seen is recorded under the counter MemoryPeak(Mo) by compute.
Public Functions Documentation
function MemoryPeak
Construct the metric with label "MemoryPeak(Mo)".
function compute
Record the collected peak on the benchmark state.
virtual void MemoryPeak::compute (
const Mesh & mesh,
const Mesh & reconstructed,
benchmark::State & state
) override const
Implements Metric::compute
function get_memory_usage_mo
Read the current resident memory of the process in MiB.
Returns:
Current memory usage in MiB.
function start
Start the background sampling thread.
Resets peak to 0 before starting.
function stop
Stop the background sampling thread and wait for it to finish.
function ~MemoryPeak
The documentation for this class was generated from the following file benchmark/metrics/implementations/bench_memory_peak.h