CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
evf::CPUStat Class Reference

#include <CPUStat.h>

Public Member Functions

void addEntry (int sta)
 
 CPUStat (unsigned int nstates, unsigned int nproc, unsigned int instance, std::string iDieUrl)
 
std::string & getChart ()
 
void printStat ()
 
void reset ()
 
void sendLegenda (const std::vector< std::string > &)
 
void sendStat (unsigned int)
 
void setCPUStat (int busyPer1k)
 
void setElapsed (int mseconds)
 
void setNproc (int nproc)
 
 ~CPUStat ()
 

Private Attributes

AsciiRollingChart chart_
 
int entries_
 
std::string iDieUrl_
 
int instance_
 
int * mstat_
 
int nproc_
 
int nstates_
 
CurlPosterposter_
 

Detailed Description

Definition at line 13 of file CPUStat.h.

Constructor & Destructor Documentation

evf::CPUStat::CPUStat ( unsigned int  nstates,
unsigned int  nproc,
unsigned int  instance,
std::string  iDieUrl 
)

Definition at line 6 of file CPUStat.cc.

References i, iDieUrl_, instance_, mstat_, nproc_, nstates_, and poster_.

9  : iDieUrl_(iDieUrl)
10  , nstates_(nstates)
11  , nproc_(nproc)
13  , entries_(0)
14  , mstat_(new int[nstates_+6])
15  , chart_("busy fraction",50)
16 {
17  poster_ = new CurlPoster(iDieUrl_);
18  for(int i = 0; i < nstates_; i++)
19  mstat_[i]=0;
21  mstat_[nstates_+1]=instance_;
22  mstat_[nstates_+2]=0;
23  mstat_[nstates_+3]=0;//cpu*1000
24  mstat_[nstates_+4]=0;//dt*1000
25  mstat_[nstates_+5]=0;//0
26 }
int i
Definition: DBlmapReader.cc:9
int instance_
Definition: CPUStat.h:51
static PFTauRenderPlugin instance
int nproc_
Definition: CPUStat.h:50
int entries_
Definition: CPUStat.h:52
CurlPoster * poster_
Definition: CPUStat.h:48
int nstates_
Definition: CPUStat.h:49
int * mstat_
Definition: CPUStat.h:53
std::string iDieUrl_
Definition: CPUStat.h:47
AsciiRollingChart chart_
Definition: CPUStat.h:54
evf::CPUStat::~CPUStat ( )

Definition at line 27 of file CPUStat.cc.

References mstat_, and poster_.

28 {
29  delete poster_;
30  delete mstat_;
31 }
CurlPoster * poster_
Definition: CPUStat.h:48
int * mstat_
Definition: CPUStat.h:53

Member Function Documentation

void evf::CPUStat::addEntry ( int  sta)
inline

Definition at line 17 of file CPUStat.h.

References entries_, and mstat_.

Referenced by evf::FUEventProcessor::supervisor().

18  {
19  mstat_[sta]++;
20  entries_++;
21  }
int entries_
Definition: CPUStat.h:52
int * mstat_
Definition: CPUStat.h:53
std::string& evf::CPUStat::getChart ( )
inline

Definition at line 43 of file CPUStat.h.

References chart_, and evf::AsciiRollingChart::draw().

Referenced by evf::FUEventProcessor::updater().

43 {return chart_.draw();}
AsciiRollingChart chart_
Definition: CPUStat.h:54
void evf::CPUStat::printStat ( )
inline

Definition at line 37 of file CPUStat.h.

References gather_cfg::cout, entries_, i, mstat_, and nstates_.

37  {
38  std::cout << "dump of microstates avg.:" << entries_ << " samples" << std::endl;
39  for(int i = 0; i < nstates_; i++)
40  if(mstat_[i]!=0) std::cout << i << " " << float(mstat_[i])/float(entries_)
41  << std::endl;
42  }
int i
Definition: DBlmapReader.cc:9
int entries_
Definition: CPUStat.h:52
int nstates_
Definition: CPUStat.h:49
int * mstat_
Definition: CPUStat.h:53
tuple cout
Definition: gather_cfg.py:121
void evf::CPUStat::reset ( void  )
inline

Definition at line 31 of file CPUStat.h.

References entries_, i, mstat_, and nstates_.

Referenced by evf::FUEventProcessor::summarize().

32  {
33  for(int i = 0; i < nstates_; i++)
34  mstat_[i]=0;
35  entries_ = 0;
36  }
int i
Definition: DBlmapReader.cc:9
int entries_
Definition: CPUStat.h:52
int nstates_
Definition: CPUStat.h:49
int * mstat_
Definition: CPUStat.h:53
void evf::CPUStat::sendLegenda ( const std::vector< std::string > &  mapmod)

Definition at line 39 of file CPUStat.cc.

References i, evf::CurlPoster::leg, python.rootplot.argparse::message, poster_, and evf::CurlPoster::postString().

Referenced by evf::FUEventProcessor::configuring(), and evf::FUEventProcessor::enabling().

40 {
41  std::string message;
42  unsigned int i = 0;
43  while(i<mapmod.size()){
44  message+=mapmod[i];
45  if(++i!=mapmod.size()) message+=",";
46  }
47  poster_->postString(message.c_str(),message.length(),0,CurlPoster::leg,"/postChoke");
48 }
int i
Definition: DBlmapReader.cc:9
void postString(const char *, size_t, unsigned int, mode, const std::string &=standard_post_method_)
Definition: CurlPoster.cc:112
CurlPoster * poster_
Definition: CPUStat.h:48
void evf::CPUStat::sendStat ( unsigned int  lsid)

Definition at line 33 of file CPUStat.cc.

References chart_, entries_, evf::AsciiRollingChart::flip(), mstat_, nstates_, evf::CurlPoster::postBinary(), and poster_.

Referenced by evf::FUEventProcessor::summarize().

34 {
35  chart_.flip(lsid,float(entries_-mstat_[2])/float(entries_));
36  poster_->postBinary((unsigned char *)mstat_,(nstates_+6)*sizeof(int),lsid,"/postChoke");
37 }
int entries_
Definition: CPUStat.h:52
void postBinary(const unsigned char *, size_t, unsigned int, const std::string &=standard_post_method_)
Definition: CurlPoster.cc:118
CurlPoster * poster_
Definition: CPUStat.h:48
void flip(unsigned int ind, float x)
int nstates_
Definition: CPUStat.h:49
int * mstat_
Definition: CPUStat.h:53
AsciiRollingChart chart_
Definition: CPUStat.h:54
void evf::CPUStat::setCPUStat ( int  busyPer1k)
inline

Definition at line 25 of file CPUStat.h.

References mstat_, and nstates_.

Referenced by evf::FUEventProcessor::summarize().

25  {
26  mstat_[nstates_+3]=busyPer1k;
27  }
int nstates_
Definition: CPUStat.h:49
int * mstat_
Definition: CPUStat.h:53
void evf::CPUStat::setElapsed ( int  mseconds)
inline

Definition at line 28 of file CPUStat.h.

References mstat_, and nstates_.

Referenced by evf::FUEventProcessor::summarize().

28  {
29  mstat_[nstates_+4]=mseconds;
30  }
int nstates_
Definition: CPUStat.h:49
int * mstat_
Definition: CPUStat.h:53
void evf::CPUStat::setNproc ( int  nproc)
inline

Definition at line 22 of file CPUStat.h.

References mstat_, errorMatrix2Lands::nproc, and nstates_.

Referenced by evf::FUEventProcessor::summarize().

22  {
24  }
int nstates_
Definition: CPUStat.h:49
int * mstat_
Definition: CPUStat.h:53

Member Data Documentation

AsciiRollingChart evf::CPUStat::chart_
private

Definition at line 54 of file CPUStat.h.

Referenced by getChart(), and sendStat().

int evf::CPUStat::entries_
private

Definition at line 52 of file CPUStat.h.

Referenced by addEntry(), printStat(), reset(), and sendStat().

std::string evf::CPUStat::iDieUrl_
private

Definition at line 47 of file CPUStat.h.

Referenced by CPUStat().

int evf::CPUStat::instance_
private

Definition at line 51 of file CPUStat.h.

Referenced by CPUStat().

int* evf::CPUStat::mstat_
private
int evf::CPUStat::nproc_
private

Definition at line 50 of file CPUStat.h.

Referenced by CPUStat().

int evf::CPUStat::nstates_
private

Definition at line 49 of file CPUStat.h.

Referenced by CPUStat(), printStat(), reset(), sendStat(), setCPUStat(), setElapsed(), and setNproc().

CurlPoster* evf::CPUStat::poster_
private

Definition at line 48 of file CPUStat.h.

Referenced by CPUStat(), sendLegenda(), sendStat(), and ~CPUStat().