49 if (!fStat.Measure()) {
50 EOUT(
"Cannot measure CPU statistic");
54 if (fStat.NumCPUs()==0)
return;
56 Par(
"CPUutil").SetValue(fStat.CPUutil(0)*100.);
58 if ((fStat.NumCPUs() > 2) && (fKind & 6))
59 for (
unsigned n=0; n < fStat.NumCPUs() - 1; n++)
60 Par(
dabc::format(
"CPU%u", n)).SetValue(fStat.CPUutil(n+1)*100.);
62 Par(
"VmSize").SetValue((
int)fStat.GetVmSize());
Represents command with its arguments.
int fKind
value of "Kind" configuration parameter, mask for 0 - just show cpu info as double parameter 1 - show...
virtual void ProcessTimerEvent(unsigned timer)
Method called by framework when timer event is produced.
CpuInfoModule(const std::string &name, dabc::Command cmd=nullptr, int kind=-1)
Base class for user-derived code, implementing event-processing.
virtual Parameter CreatePar(const std::string &name, const std::string &kind="")
unsigned CreateTimer(const std::string &name, double period_sec=-1., bool synchron=false)
Parameter & SetAverage(bool synchron=false, double interval=1.0)
Converts parameter in statistic variable.
Parameter & SetLimits(double low, double up)
Parameter & SetUnits(const std::string &unit)
Set units field of parameter.
int64_t AsInt(int64_t dflt=0) const
double AsDouble(double dflt=0.) const
Parameter Par(const std::string &name) const
Returns reference on worker parameter object.
RecordField Cfg(const std::string &name, Command cmd=nullptr) const
Returns configuration field of specified name Configuration value of specified name searched in follo...
std::string format(const char *fmt,...)