OpenMS  2.7.0
Public Member Functions | Public Attributes | Private Member Functions | List of all members
SysInfo::MemUsage Struct Reference

A convenience class to report either absolute or delta (between two timepoints) RAM usage. More...

#include <OpenMS/SYSTEM/SysInfo.h>

Collaboration diagram for SysInfo::MemUsage:
[legend]

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)
 

Detailed Description

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').

Note
Peak RAM is only supported on WindowsOS; other OS will only report Working RAM usage

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.

Constructor & Destructor Documentation

◆ MemUsage()

MemUsage ( )

C'tor, calls before() automatically.

Member Function Documentation

◆ after()

void after ( )

record data for the second timepoint

Referenced by PeptideIndexing::run().

◆ before()

void before ( )

record data for the first timepoint

◆ delta()

String delta ( const String event = "delta")

get difference in memory usage between the two timepoints after() will be called unless it was called earlier

Referenced by PeptideIndexing::run().

◆ diff_str_()

String diff_str_ ( size_t  mem_before,
size_t  mem_after 
)
private

◆ reset()

void reset ( )

forget all data (you need to call before() again)

◆ usage()

String usage ( )

get current memory usage (i.e. 'after') after() will be called unless it was called earlier

Member Data Documentation

◆ mem_after

size_t mem_after

◆ mem_after_peak

size_t mem_after_peak

◆ mem_before

size_t mem_before

◆ mem_before_peak

size_t mem_before_peak