CMS 3D CMS Logo

Public Member Functions | Public Attributes

evf::iDie::lsStat Class Reference

List of all members.

Public Member Functions

void calcStat ()
void deleteModuleSamplingPtr ()
float getDt ()
float getEvtTime ()
float getEvtTimeErr ()
float getFracBusy ()
float getFracCPUBusy ()
std::pair< unsigned int,
unsigned int > * 
getModuleSamplingPtr ()
unsigned int getNSampledNonIdle ()
float getOffenderFracAt (unsigned int x)
std::vector< std::pair
< unsigned int, unsigned int > > 
getOffendersVector ()
float getRate ()
float getRateErr ()
float getRateErrPerMachine ()
float getRatePerMachine ()
unsigned int getReports ()
 lsStat (unsigned int ls, unsigned int nbSubs, unsigned int maxreps, unsigned int nmodulenames)
void update (unsigned int nSampledNonIdle, unsigned int nSampledIdle, unsigned int nProc, unsigned int ncpubusy, unsigned int deltaTms)
 ~lsStat ()

Public Attributes

float avgDeltaT2_
float avgDeltaT_
double evtTimeAvg
double evtTimeErr
double fracCPUBusy_
double fracWaitingAvg
unsigned int ls_
std::pair< unsigned int,
unsigned int > * 
moduleSamplingSums
unsigned int nbSubs_
unsigned int nCPUBusy_
unsigned int nMaxReports_
unsigned int nmodulenames_
unsigned int nProc2_
unsigned int nProc_
unsigned int nReports_
unsigned int nSampledIdle2_
unsigned int nSampledIdle_
unsigned int nSampledNonIdle2_
unsigned int nSampledNonIdle_
double rateAvg
double rateErr
unsigned int sumDeltaTms_
bool updated_

Detailed Description

Definition at line 441 of file iDie.h.


Constructor & Destructor Documentation

evf::iDie::lsStat::lsStat ( unsigned int  ls,
unsigned int  nbSubs,
unsigned int  maxreps,
unsigned int  nmodulenames 
) [inline]

Definition at line 467 of file iDie.h.

References i, moduleSamplingSums, and nmodulenames_.

                                                                                                 :
        ls_(ls),updated_(true),nbSubs_(nbSubs),
        nSampledNonIdle_(0),nSampledNonIdle2_(0),nSampledIdle_(0),nSampledIdle2_(0),
        nProc_(0),nProc2_(0),nCPUBusy_(0),nReports_(0),nMaxReports_(maxreps),nmodulenames_(nmodulenames),
        sumDeltaTms_(0),avgDeltaT_(23),avgDeltaT2_(0)
      {
        moduleSamplingSums = new std::pair<unsigned int,unsigned int>[nmodulenames_];
        for (unsigned int i=0;i<nmodulenames_;i++) {
          moduleSamplingSums[i].first=i;
          moduleSamplingSums[i].second=0;
        }
      }
evf::iDie::lsStat::~lsStat ( ) [inline]

Definition at line 480 of file iDie.h.

References moduleSamplingSums.

                {
         delete moduleSamplingSums;
      }

Member Function Documentation

void evf::iDie::lsStat::calcStat ( ) [inline]

Definition at line 509 of file iDie.h.

References avgDeltaT2_, avgDeltaT_, evtTimeAvg, evtTimeErr, fracCPUBusy_, fracWaitingAvg, nbSubs_, nCPUBusy_, nProc2_, nProc_, nReports_, nSampledIdle2_, nSampledIdle_, nSampledNonIdle2_, nSampledNonIdle_, funct::pow(), rateAvg, rateErr, mathSSE::sqrt(), sumDeltaTms_, and updated_.

Referenced by getDt(), getEvtTime(), getEvtTimeErr(), getFracBusy(), getFracCPUBusy(), getNSampledNonIdle(), getOffenderFracAt(), getOffendersVector(), getRate(), getRateErr(), getRateErrPerMachine(), and getRatePerMachine().

      {
        if (!updated_) return;
        if (nReports_) {
          float tinv = 0.001/nReports_;
          fracCPUBusy_=nCPUBusy_*tinv;
          avgDeltaT_ = avgDeltaT2_ = sumDeltaTms_*tinv;
          if (avgDeltaT_==0.) {
            avgDeltaT_=23.;//default value
            avgDeltaT2_=0;
          }
          rateAvg=nProc_ / avgDeltaT_;
          rateErr=sqrt(fabs(nProc2_ - pow(nProc_,2)))/avgDeltaT_;
        }
        else {
          fracCPUBusy_=0.;
          rateAvg=0.;
          rateErr=0.;
          avgDeltaT_=23.;
        }

        evtTimeAvg=0.;evtTimeErr=0.;fracWaitingAvg=1.;
        unsigned int sampled = nSampledNonIdle_+nSampledIdle_;
        if (rateAvg!=0. && sampled) {
            float nAllInv = 1./sampled;
            fracWaitingAvg= nSampledIdle_*nAllInv;
            double nSampledIdleErr2=fabs(nSampledIdle2_ - pow(nSampledIdle_,2));
            double nSampledNonIdleErr2=fabs(nSampledNonIdle2_ - pow(nSampledNonIdle_,2));
            double fracWaitingAvgErr= sqrt(
                                    (pow(nSampledIdle_,2)*nSampledNonIdleErr2
                                     + pow(nSampledNonIdle_,2)*nSampledIdleErr2))*pow(nAllInv,2);
            float rateAvgInv=1./rateAvg;
            evtTimeAvg=nbSubs_ * nReports_ * (1.-fracWaitingAvg)*rateAvgInv;
            evtTimeErr = nbSubs_ * nReports_ * sqrt(pow(fracWaitingAvg*rateErr*pow(rateAvgInv,2),2) + pow(fracWaitingAvgErr*rateAvgInv,2));
        }
        updated_=false;
      }
void evf::iDie::lsStat::deleteModuleSamplingPtr ( ) [inline]

Definition at line 503 of file iDie.h.

References moduleSamplingSums, and nmodulenames_.

float evf::iDie::lsStat::getDt ( ) [inline]

Definition at line 600 of file iDie.h.

References avgDeltaT2_, calcStat(), and updated_.

Referenced by evf::iDie::updateRollingHistos().

                    {
        if (updated_) calcStat();
        return avgDeltaT2_;
      }
float evf::iDie::lsStat::getEvtTime ( ) [inline]

Definition at line 571 of file iDie.h.

References calcStat(), evtTimeAvg, and updated_.

Referenced by evf::iDie::updateRollingHistos().

                         {
        if (updated_) calcStat();
        return evtTimeAvg;
      }
float evf::iDie::lsStat::getEvtTimeErr ( ) [inline]

Definition at line 576 of file iDie.h.

References calcStat(), evtTimeErr, and updated_.

                            {
        if (updated_) calcStat();
        return evtTimeErr;
      }
float evf::iDie::lsStat::getFracBusy ( ) [inline]

Definition at line 586 of file iDie.h.

References calcStat(), fracWaitingAvg, and updated_.

Referenced by evf::iDie::updateRollingHistos().

                          {
        if (updated_) calcStat();
        return 1.-fracWaitingAvg;
      }
float evf::iDie::lsStat::getFracCPUBusy ( ) [inline]

Definition at line 591 of file iDie.h.

References calcStat(), fracCPUBusy_, and updated_.

Referenced by evf::iDie::updateRollingHistos().

                             {
        if (updated_) calcStat();
        return fracCPUBusy_;
      }
std::pair<unsigned int,unsigned int>* evf::iDie::lsStat::getModuleSamplingPtr ( ) [inline]

Definition at line 499 of file iDie.h.

References moduleSamplingSums.

Referenced by evf::iDie::parseModuleHisto().

                                                                  {
        return moduleSamplingSums;
      }
unsigned int evf::iDie::lsStat::getNSampledNonIdle ( ) [inline]

Definition at line 581 of file iDie.h.

References calcStat(), nSampledNonIdle_, and updated_.

Referenced by evf::iDie::parseModuleHisto().

                                        {
        if (updated_) calcStat();
        return nSampledNonIdle_;
      }
float evf::iDie::lsStat::getOffenderFracAt ( unsigned int  x) [inline]

Definition at line 630 of file iDie.h.

References calcStat(), first, i, moduleSamplingSums, nmodulenames_, nSampledIdle_, nSampledNonIdle_, pileupDistInMC::total, and updated_.

                                              {
        if (x<nmodulenames_) {
          if (updated_) calcStat();
          float total = nSampledNonIdle_+nSampledIdle_;
          if (total>0.) {
            for (size_t i=0;i<nmodulenames_;i++) {
              if (moduleSamplingSums[i].first==x)
              return moduleSamplingSums[i].second/total;
            }
          }
        }
        return 0.;
      }
std::vector<std::pair<unsigned int, unsigned int> > evf::iDie::lsStat::getOffendersVector ( ) [inline]

Definition at line 605 of file iDie.h.

References calcStat(), prof2calltree::count, first, MODNAMES, moduleSamplingSums, nmodulenames_, run_regression::ret, and updated_.

Referenced by evf::iDie::parseModuleHisto().

                                                                          {
        std::vector<std::pair<unsigned int, unsigned int>> ret;
        if (updated_) calcStat();
        if (moduleSamplingSums) {
          //make a copy for sorting
          std::pair<unsigned int,unsigned int> *moduleSumsCopy = new std::pair<unsigned int,unsigned int>[nmodulenames_];
          memcpy(moduleSumsCopy,moduleSamplingSums,nmodulenames_*sizeof(std::pair<unsigned int,unsigned int>));

          std::qsort((void *)moduleSumsCopy, nmodulenames_,
                     sizeof(std::pair<unsigned int,unsigned int>), modlistSortFunction);

          unsigned int count=0;
          unsigned int saveidx=0;
          while (saveidx < MODNAMES && count<nmodulenames_)
          {
            if (moduleSumsCopy[count].first==2) {count++;continue;}
            ret.push_back(moduleSumsCopy[count]);
            saveidx++;
            count++;
          }
          delete moduleSumsCopy;
        }
        return ret;
      }
float evf::iDie::lsStat::getRate ( ) [inline]

Definition at line 547 of file iDie.h.

References calcStat(), rateAvg, and updated_.

Referenced by evf::iDie::updateRollingHistos().

                      {
        if (updated_) calcStat();
        return rateAvg;
      }
float evf::iDie::lsStat::getRateErr ( ) [inline]

Definition at line 552 of file iDie.h.

References calcStat(), rateErr, and updated_.

                         {
        if (updated_) calcStat();
        return rateErr;
      }
float evf::iDie::lsStat::getRateErrPerMachine ( ) [inline]

Definition at line 564 of file iDie.h.

References calcStat(), nReports_, rateErr, and updated_.

                                   {
        if (updated_) calcStat();
        if (nReports_)
        return rateErr/(1.*nReports_);
        return 0.;
      }
float evf::iDie::lsStat::getRatePerMachine ( ) [inline]

Definition at line 557 of file iDie.h.

References calcStat(), nReports_, rateAvg, and updated_.

                                {
        if (updated_) calcStat();
        if (nReports_)
        return rateAvg/(1.*nReports_);
        return 0.;
      }
unsigned int evf::iDie::lsStat::getReports ( ) [inline]

Definition at line 596 of file iDie.h.

References nReports_.

Referenced by evf::iDie::updateRollingHistos().

                                {
        return nReports_;
      }
void evf::iDie::lsStat::update ( unsigned int  nSampledNonIdle,
unsigned int  nSampledIdle,
unsigned int  nProc,
unsigned int  ncpubusy,
unsigned int  deltaTms 
) [inline]

Definition at line 484 of file iDie.h.

References nCPUBusy_, nProc2_, nProc_, nReports_, nSampledIdle2_, nSampledIdle_, nSampledNonIdle2_, nSampledNonIdle_, funct::pow(), sumDeltaTms_, and updated_.

Referenced by evf::iDie::parseModuleHisto().

      {
        nReports_++;
        nSampledNonIdle_+=nSampledNonIdle;
        nSampledNonIdle2_+=pow(nSampledNonIdle,2);
        nSampledIdle_+=nSampledIdle;
        nSampledIdle2_+=pow(nSampledIdle,2);
        nProc_+=nProc;
        nProc2_+=pow(nProc,2);
        nCPUBusy_+=ncpubusy;
        sumDeltaTms_+=deltaTms;
        updated_=true;
      }

Member Data Documentation

Definition at line 464 of file iDie.h.

Referenced by calcStat(), and getDt().

Definition at line 463 of file iDie.h.

Referenced by calcStat().

Definition at line 457 of file iDie.h.

Referenced by calcStat(), and getEvtTime().

Definition at line 458 of file iDie.h.

Referenced by calcStat(), and getEvtTimeErr().

Definition at line 460 of file iDie.h.

Referenced by calcStat(), and getFracCPUBusy().

Definition at line 459 of file iDie.h.

Referenced by calcStat(), and getFracBusy().

unsigned int evf::iDie::lsStat::ls_

Definition at line 443 of file iDie.h.

std::pair<unsigned int,unsigned int>* evf::iDie::lsStat::moduleSamplingSums

Definition at line 445 of file iDie.h.

Referenced by calcStat().

Definition at line 452 of file iDie.h.

Referenced by calcStat(), and update().

Definition at line 454 of file iDie.h.

Definition at line 461 of file iDie.h.

Referenced by deleteModuleSamplingPtr(), getOffenderFracAt(), getOffendersVector(), and lsStat().

Definition at line 451 of file iDie.h.

Referenced by calcStat(), and update().

Definition at line 450 of file iDie.h.

Referenced by calcStat(), and update().

Definition at line 453 of file iDie.h.

Referenced by calcStat(), getRateErrPerMachine(), getRatePerMachine(), getReports(), and update().

Definition at line 449 of file iDie.h.

Referenced by calcStat(), and update().

Definition at line 448 of file iDie.h.

Referenced by calcStat(), getOffenderFracAt(), and update().

Definition at line 447 of file iDie.h.

Referenced by calcStat(), and update().

Definition at line 446 of file iDie.h.

Referenced by calcStat(), getNSampledNonIdle(), getOffenderFracAt(), and update().

Definition at line 455 of file iDie.h.

Referenced by calcStat(), getRate(), and getRatePerMachine().

Definition at line 456 of file iDie.h.

Referenced by calcStat(), getRateErr(), and getRateErrPerMachine().

Definition at line 462 of file iDie.h.

Referenced by calcStat(), and update().