CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CPUStat.h
Go to the documentation of this file.
1 #ifndef EVF_CPUSTAT
2 #define EVF_CPUSTAT
3 
4 #include <vector>
5 #include <string>
6 #include <iostream>
8 
9 namespace evf{
10 
11  class CurlPoster;
12 
13  class CPUStat{
14  public:
15  CPUStat(unsigned int nstates, unsigned int nproc, unsigned int instance, std::string iDieUrl);
16  ~CPUStat();
17  void addEntry(int sta)
18  {
19  mstat_[sta]++;
20  entries_++;
21  }
22  void setNproc(int nproc){
24  }
25  void setCPUStat(int busyPer1k) {
26  mstat_[nstates_+3]=busyPer1k;
27  }
28  void setElapsed(int mseconds) {
29  mstat_[nstates_+4]=mseconds;
30  }
31  void reset()
32  {
33  for(int i = 0; i < nstates_; i++)
34  mstat_[i]=0;
35  entries_ = 0;
36  }
37  void printStat(){
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  }
43  std::string &getChart(){return chart_.draw();}
44  void sendStat(unsigned int);
45  void sendLegenda(const std::vector<std::string> &);
46  private:
47  std::string iDieUrl_;
49  int nstates_;
50  int nproc_;
51  int instance_;
52  int entries_;
53  int *mstat_;
55  };
56 }
57 #endif
int i
Definition: DBlmapReader.cc:9
int instance_
Definition: CPUStat.h:51
static PFTauRenderPlugin instance
void printStat()
Definition: CPUStat.h:37
void setCPUStat(int busyPer1k)
Definition: CPUStat.h:25
int nproc_
Definition: CPUStat.h:50
void setElapsed(int mseconds)
Definition: CPUStat.h:28
int entries_
Definition: CPUStat.h:52
CurlPoster * poster_
Definition: CPUStat.h:48
void setNproc(int nproc)
Definition: CPUStat.h:22
void addEntry(int sta)
Definition: CPUStat.h:17
void sendStat(unsigned int)
Definition: CPUStat.cc:33
void reset()
Definition: CPUStat.h:31
CPUStat(unsigned int nstates, unsigned int nproc, unsigned int instance, std::string iDieUrl)
Definition: CPUStat.cc:6
std::string & getChart()
Definition: CPUStat.h:43
int nstates_
Definition: CPUStat.h:49
void sendLegenda(const std::vector< std::string > &)
Definition: CPUStat.cc:39
int * mstat_
Definition: CPUStat.h:53
tuple cout
Definition: gather_cfg.py:121
std::string iDieUrl_
Definition: CPUStat.h:47
AsciiRollingChart chart_
Definition: CPUStat.h:54