OpenMS
|
A convenience class to report either absolute or delta (between two timepoints) RAM usage. More...
#include <OpenMS/SYSTEM/SysInfo.h>
Public Member Functions | |
MemUsage () | |
C'tor, calls before() automatically. More... | |
void | reset () |
forget all data (you need to call before() again) More... | |
void | before () |
record data for the first timepoint More... | |
void | after () |
record data for the second timepoint More... | |
String | delta (const String &event="delta") |
String | usage () |
Public Attributes | |
size_t | mem_before |
size_t | mem_before_peak |
size_t | mem_after |
size_t | mem_after_peak |
Private Member Functions | |
String | diff_str_ (size_t mem_before, size_t mem_after) |
A convenience class to report either absolute or delta (between two timepoints) RAM usage.
Working RAM and Peak RAM usage are recorded at two time points ('before' and 'after').
When constructed, MemUsage automatically queries the present RAM usage (first timepoint), i.e. calls before(). Data for the second timepoint can be recorded using after().
delta() reports the difference between the timepoints (before -> after); usage() reports only the second timepoint's absolute value (after).
When delta() or usage() are called, and the second timepoint is not recorded yet, this will be done internally.
void after | ( | ) |
record data for the second timepoint
void before | ( | ) |
record data for the first timepoint
get difference in memory usage between the two timepoints after() will be called unless it was called earlier
|
private |
void reset | ( | ) |
forget all data (you need to call before() again)
String usage | ( | ) |
get current memory usage (i.e. 'after') after() will be called unless it was called earlier
size_t mem_after |
size_t mem_after_peak |
size_t mem_before |
size_t mem_before_peak |