CMS 3D CMS Logo

Public Member Functions | Private Attributes

evf::CPUStat Class Reference

#include <CPUStat.h>

List of all members.

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 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_.

                                    : iDieUrl_(iDieUrl)
                                      , nstates_(nstates)
                                      , nproc_(nproc)
                                      , instance_(instance)
                                      , entries_(0)
                                      , mstat_(new int[nstates_+3])
                                      , chart_("busy fraction",50)
{
  poster_ = new CurlPoster(iDieUrl_);
  for(int i = 0; i < nstates_; i++)
    mstat_[i]=0;        
  mstat_[nstates_]=nproc_;
  mstat_[nstates_+1]=instance_;
  mstat_[nstates_+2]=0;
}
evf::CPUStat::~CPUStat ( )

Definition at line 24 of file CPUStat.cc.

References mstat_, and poster_.

{
  delete poster_;
  delete mstat_;
}

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().

    {
      mstat_[sta]++;
      entries_++;
    }
std::string& evf::CPUStat::getChart ( ) [inline]

Definition at line 37 of file CPUStat.h.

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

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

{return chart_.draw();}
void evf::CPUStat::printStat ( ) [inline]

Definition at line 31 of file CPUStat.h.

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

                    {
      std::cout << "dump of microstates avg.:" << entries_ << " samples" << std::endl;
      for(int i = 0; i < nstates_; i++)
        if(mstat_[i]!=0) std::cout << i << " " << float(mstat_[i])/float(entries_)
                                   << std::endl;
    }
void evf::CPUStat::reset ( void  ) [inline]

Definition at line 25 of file CPUStat.h.

References entries_, i, mstat_, and nstates_.

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

    {
      for(int i = 0; i < nstates_; i++)
        mstat_[i]=0;    
      entries_ = 0;
    }
void evf::CPUStat::sendLegenda ( const std::vector< std::string > &  mapmod)

Definition at line 36 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().

{
  std::string message;
  unsigned int i = 0;
  while(i<mapmod.size()){
    message+=mapmod[i];
    if(++i!=mapmod.size()) message+=",";
  }
  poster_->postString(message.c_str(),message.length(),0,CurlPoster::leg,"/postChoke");
}
void evf::CPUStat::sendStat ( unsigned int  lsid)

Definition at line 30 of file CPUStat.cc.

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

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

{
  chart_.flip(lsid,float(entries_-mstat_[2])/float(entries_));
  poster_->postBinary((unsigned char *)mstat_,(nstates_+4)*sizeof(int),lsid,"/postChoke");
}
void evf::CPUStat::setNproc ( int  nproc) [inline]

Definition at line 22 of file CPUStat.h.

References mstat_, and nstates_.

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

                            {
      mstat_[nstates_+2]=nproc;
    }

Member Data Documentation

Definition at line 48 of file CPUStat.h.

Referenced by getChart(), and sendStat().

int evf::CPUStat::entries_ [private]

Definition at line 46 of file CPUStat.h.

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

std::string evf::CPUStat::iDieUrl_ [private]

Definition at line 41 of file CPUStat.h.

Referenced by CPUStat().

int evf::CPUStat::instance_ [private]

Definition at line 45 of file CPUStat.h.

Referenced by CPUStat().

int* evf::CPUStat::mstat_ [private]

Definition at line 47 of file CPUStat.h.

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

int evf::CPUStat::nproc_ [private]

Definition at line 44 of file CPUStat.h.

Referenced by CPUStat().

int evf::CPUStat::nstates_ [private]

Definition at line 43 of file CPUStat.h.

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

Definition at line 42 of file CPUStat.h.

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