12#define SYSMON_ENABLE_SYSCONF
15#define SYSMON_ENABLE_SYSINFO
17#define SYSMON_ENABLE_MALLINFO
18#define SYSMON_ENABLE_PROCMEMINFO
19#define SYSMON_ENABLE_PROCVMSTAT
20#define SYSMON_ENABLE_PROCLOADAVG
21#define SYSMON_ENABLE_PROCSELFSTATM
22#define SYSMON_ENABLE_PROCSELFSCHED
24#define SYSMON_ENABLE_PROCSELFSTATUS
41#ifdef SYSMON_ENABLE_SYSCONF
45#ifdef SYSMON_ENABLE_SYSINFO
46#include <sys/sysinfo.h>
49#ifdef SYSMON_ENABLE_MALLINFO
59 typedef double Tvalue;
61 static const MPI_Datatype mpiTvalue;
62 static const int mpiRootRank;
66 static SysMon* s_sysmoninstance;
73 ~
~SysMon() { clear();
delete(_variableset); s_sysmoninstance=NULL; }
78 if(s_sysmoninstance==NULL)
79 s_sysmoninstance =
new SysMon();
80 return s_sysmoninstance;
86 {
int idx=addExpression(exprstr);
if(idx>=0) _expressions.back().setLabel(label);
return idx; }
87 unsigned int numExpressions() {
return _expressions.size(); }
88 void updateExpressionValues(
bool resetMinMax=
false);
89 int getExpressionIndex(
const std::string& label)
const;
90 Tvalue getExpressionValue(
unsigned int index)
const
91 {
if(index<_values.size())
return _values[index];
else return Tvalue(); }
92 std::pair<Tvalue,Tvalue> getExpressionMinMaxPeakValues(
unsigned int index)
const
93 {
if(index*2+1<_valuesMaxMinPeak.size())
return std::make_pair(_valuesMaxMinPeak[index*2],_valuesMaxMinPeak[index*2+1]);
else return std::make_pair(0,0); }
95 std::pair<Tvalue,Tvalue> getExpressionMinMaxValues(
unsigned int index)
const;
97 void writeExpressionValues(std::ostream& ostrm=std::cout
109 std::ostringstream oss;
110 writeExpressionValues(oss,header,lineprefix,sep,eol);
113 operator std::string()
const {
return InfoString(); }
117 std::list<Expression> _expressions;
118 std::vector<Tvalue> _values;
119 std::vector<bool> _initMinMax;
122 std::vector<Tvalue> _valuesMaxMinPeak;
124 std::vector<Tvalue> _valuesMaxMin;
129 unsigned int updateVariables_sysconf();
130 unsigned int updateVariables_sysinfo();
131 unsigned int updateVariables_mallinfo();
132 unsigned int updateVariables_procmeminfo();
133 unsigned int updateVariables_procvmstat();
134 unsigned int updateVariables_procloadavg();
135 unsigned int updateVariables_procselfstatm();
136 unsigned int updateVariables_procselfschedstat();
137 unsigned int updateVariables_procselfsched();
138 unsigned int updateVariables_procselfstatus();
143inline std::ostream& operator << (std::ostream& ostrm,
const SysMon& s)
145 s.writeExpressionValues(ostrm);
Expression (tree) with variables.
Definition: Expression.h:240
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270