CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

edm::service::PathTimerService Class Reference

#include <PathTimerService.h>

List of all members.

Public Member Functions

std::auto_ptr< HLTPerformanceInfogetInfo ()
 PathTimerService (const ParameterSet &, ActivityRegistry &)
 ~PathTimerService ()

Private Member Functions

void postBeginJob ()
void postEndJob ()
void postEventProcessing (const Event &, const EventSetup &)
void postModule (const ModuleDescription &)
void postPathProcessing (const std::string &, const HLTPathStatus &)
void preEventProcessing (const edm::EventID &, const edm::Timestamp &)
void preModule (const ModuleDescription &)

Private Attributes

std::map< std::string,
unsigned int > 
_lastModuleToRun
std::map< std::string, double > _moduleCPUTime
std::map< std::string,
std::string > 
_moduleList
std::map< std::string, double > _moduleTime
ParameterSet _myPS
std::vector< std::vector
< unsigned int > > 
_newPathIndex
std::map< int, std::string > _pathMapping
std::auto_ptr< HLTPerformanceInfo_perfInfo
edm::EventID curr_event_
double curr_event_time_
double curr_job_
double curr_module_time_
double max_event_time_
double min_event_time_
int total_event_count_

Static Private Attributes

static edm::CPUTimer_CPUtimer = 0

Detailed Description

Definition at line 23 of file PathTimerService.h.


Constructor & Destructor Documentation

edm::service::PathTimerService::PathTimerService ( const ParameterSet iPS,
ActivityRegistry iRegistry 
)
edm::service::PathTimerService::~PathTimerService ( )

Definition at line 59 of file PathTimerService.cc.

References _CPUtimer.

                                            {
            if (_CPUtimer) {
                delete _CPUtimer ;
                _CPUtimer = 0 ;
            }
        }

Member Function Documentation

std::auto_ptr<HLTPerformanceInfo> edm::service::PathTimerService::getInfo ( ) [inline]

Definition at line 29 of file PathTimerService.h.

References _perfInfo.

{ return std::auto_ptr<HLTPerformanceInfo>(new HLTPerformanceInfo(*_perfInfo));}
void edm::service::PathTimerService::postBeginJob ( ) [private]

Definition at line 67 of file PathTimerService.cc.

References _moduleCPUTime, _moduleTime, _newPathIndex, _pathMapping, _perfInfo, curr_job_, funct::false, edm::service::getTime(), i, j, gen::k, edm::hlt::Ready, and funct::true.

Referenced by PathTimerService().

                                            {

            edm::Service<edm::service::TriggerNamesService> tns;
            std::vector<std::string> trigPaths= tns->getTrigPaths();
            for ( unsigned int i=0; i<trigPaths.size(); i++) {
                _pathMapping[i]=trigPaths[i];
                HLTPerformanceInfo::Path hltPath(trigPaths[i]);
                std::vector<unsigned int> loc ; 
                const std::vector<std::string> modules=tns->getTrigPathModules(trigPaths[i]);
                unsigned int mIdx = 0 ; 
                _perfInfo->addPath(hltPath);
                for ( unsigned int j=0; j<modules.size(); j++) {
                    _moduleTime[modules[j]]=0. ;
                    _moduleCPUTime[modules[j]]=0. ;
                    HLTPerformanceInfo::Modules::const_iterator iMod =
                        _perfInfo->findModule(modules[j].c_str());
                    if ( iMod == _perfInfo->endModules() ) {
                        HLTPerformanceInfo::Module hltModule(modules[j].c_str(),0.,0.,hlt::Ready);
                        _perfInfo->addModule(hltModule);
                    }

                    //--- Check the module frequency in the path ---//
                    bool duplicateModule = false ; 
                    for (unsigned int k=0; k<j; k++) {
                        if (modules[k] == modules[j]) {
                            if (!duplicateModule) loc.push_back(k) ; 
                            duplicateModule = true ;
                        }
                    }
                    if (!duplicateModule) {
                      _perfInfo->addModuleToPath(modules[j].c_str(),trigPaths[i].c_str());
                        loc.push_back(mIdx++) ; 
                    }
                }
                _newPathIndex.push_back(loc) ;
            }
            curr_job_ = getTime();
        }
void edm::service::PathTimerService::postEndJob ( ) [private]

Definition at line 106 of file PathTimerService.cc.

Referenced by PathTimerService().

{}
void edm::service::PathTimerService::postEventProcessing ( const Event e,
const EventSetup  
) [private]

Definition at line 128 of file PathTimerService.cc.

References total_event_count_.

Referenced by PathTimerService().

void edm::service::PathTimerService::postModule ( const ModuleDescription desc) [private]

Definition at line 137 of file PathTimerService.cc.

References _CPUtimer, _moduleCPUTime, _moduleTime, _perfInfo, edm::CPUTimer::cpuTime(), edm::ModuleDescription::moduleLabel(), edm::CPUTimer::realTime(), edm::CPUTimer::reset(), and edm::CPUTimer::stop().

Referenced by PathTimerService().

                                                                     {

          _CPUtimer->stop() ;
          double tWall = _CPUtimer->realTime() ; 
          double tCPU  = _CPUtimer->cpuTime() ;
          _CPUtimer->reset() ; 
      
          _moduleTime[desc.moduleLabel()] = tWall ;
          _moduleCPUTime[desc.moduleLabel()] = tCPU ; 
        
          HLTPerformanceInfo::Modules::iterator iMod =
              _perfInfo->findModule(desc.moduleLabel().c_str());
          if ( iMod != _perfInfo->endModules() ) {
            iMod->setTime(tWall) ;
            iMod->setCPUTime(tCPU) ;
          }

      }
void edm::service::PathTimerService::postPathProcessing ( const std::string &  name,
const HLTPathStatus status 
) [private]

Definition at line 156 of file PathTimerService.cc.

References _newPathIndex, _perfInfo, edm::HLTPathStatus::index(), mergeVDriftHistosByStation::name, and edm::HLTPathStatus::state().

Referenced by PathTimerService().

                                                                             {
          HLTPerformanceInfo::PathList::iterator iPath=_perfInfo->beginPaths();
          int ctr = 0 ; 
          while ( iPath != _perfInfo->endPaths() ) {
            if ( iPath->name() == name) { 
              unsigned int pIndex = _newPathIndex.at(ctr).at(status.index()) ;
              iPath->setStatus(HLTPathStatus(status.state(),pIndex)) ; 
              _perfInfo->setStatusOfModulesFromPath(name.c_str());
            }
            iPath++;
            ctr++; 

          }

      }
void edm::service::PathTimerService::preEventProcessing ( const edm::EventID iID,
const edm::Timestamp iTime 
) [private]

Definition at line 108 of file PathTimerService.cc.

References _moduleCPUTime, _moduleTime, _perfInfo, curr_event_, curr_event_time_, and edm::service::getTime().

Referenced by PathTimerService().

                                                               {
      curr_event_ = iID;
      curr_event_time_ = getTime();

      _perfInfo->clearModules();
      
      std::map<std::string, double>::iterator iter=_moduleTime.begin();
      std::map<std::string, double>::iterator iCPU=_moduleCPUTime.begin();

      while ( iter != _moduleTime.end()) {
        (*iter).second=0.;
        iter++;
      }
      while ( iCPU != _moduleCPUTime.end()) {
        (*iCPU).second=0.;
        iCPU++;
      }

    }
void edm::service::PathTimerService::preModule ( const ModuleDescription ) [private]

Definition at line 132 of file PathTimerService.cc.

References _CPUtimer, edm::CPUTimer::reset(), and edm::CPUTimer::start().

Referenced by PathTimerService().

                                                             {
        _CPUtimer->reset() ; 
        _CPUtimer->start() ; 
    }

Member Data Documentation

Definition at line 61 of file PathTimerService.h.

Referenced by PathTimerService(), postModule(), preModule(), and ~PathTimerService().

std::map<std::string, unsigned int> edm::service::PathTimerService::_lastModuleToRun [private]

Definition at line 58 of file PathTimerService.h.

std::map<std::string, double> edm::service::PathTimerService::_moduleCPUTime [private]

Definition at line 56 of file PathTimerService.h.

Referenced by postBeginJob(), postModule(), and preEventProcessing().

std::map<std::string, std::string> edm::service::PathTimerService::_moduleList [private]

Definition at line 54 of file PathTimerService.h.

std::map<std::string, double> edm::service::PathTimerService::_moduleTime [private]

Definition at line 55 of file PathTimerService.h.

Referenced by postBeginJob(), postModule(), and preEventProcessing().

Definition at line 53 of file PathTimerService.h.

Referenced by PathTimerService().

std::vector< std::vector<unsigned int> > edm::service::PathTimerService::_newPathIndex [private]

Definition at line 60 of file PathTimerService.h.

Referenced by postBeginJob(), and postPathProcessing().

std::map<int, std::string> edm::service::PathTimerService::_pathMapping [private]

Definition at line 57 of file PathTimerService.h.

Referenced by postBeginJob().

Definition at line 41 of file PathTimerService.h.

Referenced by preEventProcessing().

Definition at line 43 of file PathTimerService.h.

Referenced by preEventProcessing().

Definition at line 42 of file PathTimerService.h.

Referenced by postBeginJob().

Definition at line 44 of file PathTimerService.h.

Definition at line 49 of file PathTimerService.h.

Definition at line 50 of file PathTimerService.h.

Definition at line 51 of file PathTimerService.h.

Referenced by postEventProcessing().