CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CPUStat.cc
Go to the documentation of this file.
3 
4 namespace evf{
5 
6 CPUStat::CPUStat(unsigned int nstates,
7  unsigned int nproc,
8  unsigned int instance,
9  std::string iDieUrl) : iDieUrl_(iDieUrl)
10  , nstates_(nstates)
11  , nproc_(nproc)
12  , instance_(instance)
13  , entries_(0)
14  , mstat_(new int[nstates_+6])
15  , chart_("busy fraction",50)
16 {
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 }
28 {
29  delete poster_;
30  delete mstat_;
31 }
32 
33  void CPUStat::sendStat(unsigned int lsid)
34 {
35  chart_.flip(lsid,float(entries_-mstat_[2])/float(entries_));
36  poster_->postBinary((unsigned char *)mstat_,(nstates_+6)*sizeof(int),lsid,"/postChoke");
37 }
38 
39 void CPUStat::sendLegenda(const std::vector<std::string> &mapmod)
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 }
49 
50 }
int i
Definition: DBlmapReader.cc:9
int instance_
Definition: CPUStat.h:51
static PFTauRenderPlugin instance
int nproc_
Definition: CPUStat.h:50
void postString(const char *, size_t, unsigned int, mode, const std::string &=standard_post_method_)
Definition: CurlPoster.cc:112
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 sendStat(unsigned int)
Definition: CPUStat.cc:33
CPUStat(unsigned int nstates, unsigned int nproc, unsigned int instance, std::string iDieUrl)
Definition: CPUStat.cc:6
void flip(unsigned int ind, float x)
int nstates_
Definition: CPUStat.h:49
void sendLegenda(const std::vector< std::string > &)
Definition: CPUStat.cc:39
int * mstat_
Definition: CPUStat.h:53
std::string iDieUrl_
Definition: CPUStat.h:47
AsciiRollingChart chart_
Definition: CPUStat.h:54