#include <PathTimerService.h>
Public Member Functions | |
std::auto_ptr< HLTPerformanceInfo > | getInfo () |
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 |
Definition at line 23 of file PathTimerService.h.
edm::service::PathTimerService::PathTimerService | ( | const ParameterSet & | iPS, |
ActivityRegistry & | iRegistry | ||
) |
Definition at line 38 of file PathTimerService.cc.
References _CPUtimer, _myPS, postBeginJob(), postEndJob(), postEventProcessing(), postModule(), postPathProcessing(), preEventProcessing(), preModule(), edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPostProcessEvent(), edm::ActivityRegistry::watchPostProcessPath(), edm::ActivityRegistry::watchPreModule(), and edm::ActivityRegistry::watchPreProcessEvent().
: total_event_count_(0), _perfInfo(new HLTPerformanceInfo) { iRegistry.watchPostBeginJob(this,&PathTimerService::postBeginJob); iRegistry.watchPostEndJob(this,&PathTimerService::postEndJob); iRegistry.watchPreProcessEvent(this,&PathTimerService::preEventProcessing); iRegistry.watchPostProcessEvent(this,&PathTimerService::postEventProcessing); iRegistry.watchPreModule(this,&PathTimerService::preModule); iRegistry.watchPostModule(this,&PathTimerService::postModule); iRegistry.watchPostProcessPath(this,&PathTimerService::postPathProcessing); _myPS=iPS; if (!_CPUtimer) _CPUtimer = new edm::CPUTimer(); }
edm::service::PathTimerService::~PathTimerService | ( | ) |
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] |
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().
{ total_event_count_ = total_event_count_ + 1; }
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().
edm::CPUTimer * edm::service::PathTimerService::_CPUtimer = 0 [static, private] |
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().
std::auto_ptr<HLTPerformanceInfo> edm::service::PathTimerService::_perfInfo [private] |
Definition at line 59 of file PathTimerService.h.
Referenced by getInfo(), postBeginJob(), postModule(), postPathProcessing(), and preEventProcessing().
Definition at line 41 of file PathTimerService.h.
Referenced by preEventProcessing().
double edm::service::PathTimerService::curr_event_time_ [private] |
Definition at line 43 of file PathTimerService.h.
Referenced by preEventProcessing().
double edm::service::PathTimerService::curr_job_ [private] |
Definition at line 42 of file PathTimerService.h.
Referenced by postBeginJob().
double edm::service::PathTimerService::curr_module_time_ [private] |
Definition at line 44 of file PathTimerService.h.
double edm::service::PathTimerService::max_event_time_ [private] |
Definition at line 49 of file PathTimerService.h.
double edm::service::PathTimerService::min_event_time_ [private] |
Definition at line 50 of file PathTimerService.h.
int edm::service::PathTimerService::total_event_count_ [private] |
Definition at line 51 of file PathTimerService.h.
Referenced by postEventProcessing().