concepts::ResourceMonitor Class Reference

Timer and resource monitor. More...

#include <resourceMonitor.hh>

Public Member Functions

 ResourceMonitor ()
 Default constructor. More...
 
std::ostream & sample (std::ostream &os)
 Returns an output stream with resource information. More...
 
float utime ()
 Returns the user time since the last call of ResourceMonitor using getrusage. More...
 

Private Attributes

rusage ru_
 Stores snapshot of resources since construction or last output. More...
 

Friends

std::ostream & operator<< (std::ostream &os, ResourceMonitor &rm)
 

Detailed Description

Timer and resource monitor.

Examples
hpFEM2d.cc, and hpFEM3d-EV.cc.

Definition at line 29 of file resourceMonitor.hh.

Constructor & Destructor Documentation

◆ ResourceMonitor()

concepts::ResourceMonitor::ResourceMonitor ( )
inline

Default constructor.

Initializes the timer and resource monitor, ie. fills ru_.

Definition at line 41 of file resourceMonitor.hh.

Member Function Documentation

◆ sample()

std::ostream& concepts::ResourceMonitor::sample ( std::ostream &  os)

Returns an output stream with resource information.

There are timing information since construction or last output and memory usage information of the process.

Example:

3.21s [utime = 6.36s, stime = 3.09s, minflt = 0, majflt = 0, maxrss = 0.00KB]

the numbers before the [] gives the user and system time since the last output. The time values in the [] are the cumulated user and system time since the process started.
minflt gives the number of page faults not requiring physical I/O
maxflt gives the number of page faults requiring physical I/O
maxrss gives the memory needed by the process

◆ utime()

float concepts::ResourceMonitor::utime ( )

Returns the user time since the last call of ResourceMonitor using getrusage.

This is not very precise (1/100 sec).

Examples
hpFEM2d.cc, and hpFEM3d-EV.cc.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
ResourceMonitor rm 
)
friend

Definition at line 30 of file resourceMonitor.hh.

Member Data Documentation

◆ ru_

rusage concepts::ResourceMonitor::ru_
private

Stores snapshot of resources since construction or last output.

Definition at line 36 of file resourceMonitor.hh.


The documentation for this class was generated from the following file:
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich