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, std::string iDieUrl)
 
void printStat ()
 
void reset ()
 
void sendLegenda (const std::vector< std::string > &)
 
void sendStat (unsigned int)
 
 ~CPUStat ()
 

Private Attributes

int entries_
 
std::string iDieUrl_
 
int * mstat_
 
int nstates_
 
CurlPosterposter_
 

Detailed Description

Definition at line 12 of file CPUStat.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file CPUStat.cc.

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

6  : iDieUrl_(iDieUrl)
7  , nstates_(nstates)
8  , entries_(0)
9  , mstat_(new int[nstates_])
10 {
11  poster_ = new CurlPoster(iDieUrl_);
12  for(int i = 0; i < nstates_; i++)
13  mstat_[i]=0;
14 }
int i
Definition: DBlmapReader.cc:9
int entries_
Definition: CPUStat.h:39
CurlPoster * poster_
Definition: CPUStat.h:37
int nstates_
Definition: CPUStat.h:38
int * mstat_
Definition: CPUStat.h:40
std::string iDieUrl_
Definition: CPUStat.h:36
evf::CPUStat::~CPUStat ( )

Definition at line 15 of file CPUStat.cc.

References mstat_, and poster_.

16 {
17  delete poster_;
18  delete mstat_;
19 }
CurlPoster * poster_
Definition: CPUStat.h:37
int * mstat_
Definition: CPUStat.h:40

Member Function Documentation

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

Definition at line 16 of file CPUStat.h.

References entries_, and mstat_.

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

17  {
18  mstat_[sta]++;
19  entries_++;
20  }
int entries_
Definition: CPUStat.h:39
int * mstat_
Definition: CPUStat.h:40
void evf::CPUStat::printStat ( )
inline

Definition at line 27 of file CPUStat.h.

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

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

Definition at line 21 of file CPUStat.h.

References entries_, i, mstat_, and nstates_.

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

22  {
23  for(int i = 0; i < nstates_; i++)
24  mstat_[i]=0;
25  entries_ = 0;
26  }
int i
Definition: DBlmapReader.cc:9
int entries_
Definition: CPUStat.h:39
int nstates_
Definition: CPUStat.h:38
int * mstat_
Definition: CPUStat.h:40
void evf::CPUStat::sendLegenda ( const std::vector< std::string > &  mapmod)

Definition at line 26 of file CPUStat.cc.

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

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

27 {
28  std::string message;
29  unsigned int i = 0;
30  while(i<mapmod.size()){
31  message+=mapmod[i];
32  if(++i!=mapmod.size()) message+=",";
33  }
34  poster_->postString(message.c_str(),message.length(),0,CurlPoster::leg,"/postChoke");
35 }
int i
Definition: DBlmapReader.cc:9
void postString(const char *, size_t, unsigned int, mode, const std::string &=standard_post_method_)
Definition: CurlPoster.cc:104
CurlPoster * poster_
Definition: CPUStat.h:37
string message
Definition: argparse.py:126
void evf::CPUStat::sendStat ( unsigned int  lsid)

Definition at line 21 of file CPUStat.cc.

References mstat_, nstates_, evf::CurlPoster::postBinary(), and poster_.

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

22 {
23  poster_->postBinary((unsigned char *)mstat_,(nstates_+1)*sizeof(int),lsid,"/postChoke");
24 }
void postBinary(const unsigned char *, size_t, unsigned int, const std::string &=standard_post_method_)
Definition: CurlPoster.cc:110
CurlPoster * poster_
Definition: CPUStat.h:37
int nstates_
Definition: CPUStat.h:38
int * mstat_
Definition: CPUStat.h:40

Member Data Documentation

int evf::CPUStat::entries_
private

Definition at line 39 of file CPUStat.h.

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

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

Definition at line 36 of file CPUStat.h.

Referenced by CPUStat().

int* evf::CPUStat::mstat_
private

Definition at line 40 of file CPUStat.h.

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

int evf::CPUStat::nstates_
private

Definition at line 38 of file CPUStat.h.

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

CurlPoster* evf::CPUStat::poster_
private

Definition at line 37 of file CPUStat.h.

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