CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/EventFilter/Utilities/src/CPUStat.cc

Go to the documentation of this file.
00001 #include "EventFilter/Utilities/interface/CPUStat.h"
00002 #include "EventFilter/Utilities/interface/CurlPoster.h"
00003 
00004 namespace evf{
00005 
00006 CPUStat::CPUStat(unsigned int nstates, std::string iDieUrl) : iDieUrl_(iDieUrl)
00007                                                             , nstates_(nstates)
00008                                                             , entries_(0)
00009                                                             , mstat_(new int[nstates_])
00010 {
00011   poster_ = new CurlPoster(iDieUrl_);
00012   for(int i = 0; i < nstates_; i++)
00013     mstat_[i]=0;        
00014 }
00015 CPUStat::~CPUStat()
00016 {
00017   delete poster_;
00018   delete mstat_;
00019 }
00020 
00021 void CPUStat::sendStat(unsigned int lsid)
00022 {
00023   poster_->postBinary((unsigned char *)mstat_,(nstates_+1)*sizeof(int),lsid,"/postChoke");
00024 }
00025 
00026 void CPUStat::sendLegenda(const std::vector<std::string> &mapmod)
00027 {
00028   std::string message;
00029   unsigned int i = 0;
00030   while(i<mapmod.size()){
00031     message+=mapmod[i];
00032     if(++i!=mapmod.size()) message+=",";
00033   }
00034   poster_->postString(message.c_str(),message.length(),0,CurlPoster::leg,"/postChoke");
00035 }
00036 
00037 }