CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
edm::service::PathTimerService Class Reference

#include <PathTimerService.h>

Public Member Functions

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

Public Attributes

sigc::signal< void, const
edm::ModuleDescription
&, double > 
newMeasurementSignal
 

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 24 of file PathTimerService.h.

Constructor & Destructor Documentation

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

38  :
41  {
42  iRegistry.watchPostBeginJob(this,&PathTimerService::postBeginJob);
43  iRegistry.watchPostEndJob(this,&PathTimerService::postEndJob);
44 
45  iRegistry.watchPreProcessEvent(this,&PathTimerService::preEventProcessing);
46  iRegistry.watchPostProcessEvent(this,&PathTimerService::postEventProcessing);
47 
48  iRegistry.watchPreModule(this,&PathTimerService::preModule);
49  iRegistry.watchPostModule(this,&PathTimerService::postModule);
50 
51  iRegistry.watchPostProcessPath(this,&PathTimerService::postPathProcessing);
52 
53  _myPS=iPS;
54 
55  if (!_CPUtimer) _CPUtimer = new edm::CPUTimer();
56  }
void preModule(const ModuleDescription &)
static edm::CPUTimer * _CPUtimer
void postEventProcessing(const Event &, const EventSetup &)
void postPathProcessing(const std::string &, const HLTPathStatus &)
void preEventProcessing(const edm::EventID &, const edm::Timestamp &)
void postModule(const ModuleDescription &)
std::auto_ptr< HLTPerformanceInfo > _perfInfo
edm::service::PathTimerService::~PathTimerService ( )

Definition at line 59 of file PathTimerService.cc.

References _CPUtimer.

59  {
60  if (_CPUtimer) {
61  delete _CPUtimer ;
62  _CPUtimer = 0 ;
63  }
64  }
static edm::CPUTimer * _CPUtimer

Member Function Documentation

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

Definition at line 32 of file PathTimerService.h.

References _perfInfo.

Referenced by PathTimerInserter::produce().

32 { return std::auto_ptr<HLTPerformanceInfo>(new HLTPerformanceInfo(*_perfInfo));}
std::auto_ptr< 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(), edm::service::TriggerNamesService::getTrigPathModules(), edm::service::TriggerNamesService::getTrigPaths(), i, j, gen::k, edm::hlt::Ready, and funct::true.

Referenced by PathTimerService().

67  {
68 
70  std::vector<std::string> trigPaths= tns->getTrigPaths();
71  for ( unsigned int i=0; i<trigPaths.size(); i++) {
72  _pathMapping[i]=trigPaths[i];
73  HLTPerformanceInfo::Path hltPath(trigPaths[i]);
74  std::vector<unsigned int> loc ;
75  const std::vector<std::string> modules=tns->getTrigPathModules(trigPaths[i]);
76  unsigned int mIdx = 0 ;
77  _perfInfo->addPath(hltPath);
78  for ( unsigned int j=0; j<modules.size(); j++) {
79  _moduleTime[modules[j]]=0. ;
80  _moduleCPUTime[modules[j]]=0. ;
81  HLTPerformanceInfo::Modules::const_iterator iMod =
82  _perfInfo->findModule(modules[j].c_str());
83  if ( iMod == _perfInfo->endModules() ) {
84  HLTPerformanceInfo::Module hltModule(modules[j].c_str(),0.,0.,hlt::Ready);
85  _perfInfo->addModule(hltModule);
86  }
87 
88  //--- Check the module frequency in the path ---//
89  bool duplicateModule = false ;
90  for (unsigned int k=0; k<j; k++) {
91  if (modules[k] == modules[j]) {
92  if (!duplicateModule) loc.push_back(k) ;
93  duplicateModule = true ;
94  }
95  }
96  if (!duplicateModule) {
97  _perfInfo->addModuleToPath(modules[j].c_str(),trigPaths[i].c_str());
98  loc.push_back(mIdx++) ;
99  }
100  }
101  _newPathIndex.push_back(loc) ;
102  }
103  curr_job_ = getTime();
104  }
std::map< int, std::string > _pathMapping
int i
Definition: DBlmapReader.cc:9
Strings const & getTrigPathModules(std::string const &name) const
not [yet] run
Definition: HLTenums.h:21
std::map< std::string, double > _moduleCPUTime
std::vector< std::vector< unsigned int > > _newPathIndex
int j
Definition: DBlmapReader.cc:9
std::map< std::string, double > _moduleTime
int k[5][pyjets_maxn]
Strings const & getTrigPaths() const
static double getTime()
std::auto_ptr< HLTPerformanceInfo > _perfInfo
void edm::service::PathTimerService::postEndJob ( )
private

Definition at line 106 of file PathTimerService.cc.

Referenced by PathTimerService().

106 {}
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().

137  {
138 
139  _CPUtimer->stop() ;
140  double tWall = _CPUtimer->realTime() ;
141  double tCPU = _CPUtimer->cpuTime() ;
142  _CPUtimer->reset() ;
143 
144  _moduleTime[desc.moduleLabel()] = tWall ;
145  _moduleCPUTime[desc.moduleLabel()] = tCPU ;
146 
147  HLTPerformanceInfo::Modules::iterator iMod =
148  _perfInfo->findModule(desc.moduleLabel().c_str());
149  if ( iMod != _perfInfo->endModules() ) {
150  iMod->setTime(tWall) ;
151  iMod->setCPUTime(tCPU) ;
152  }
153 
154  }
std::map< std::string, double > _moduleCPUTime
void reset()
Definition: CPUTimer.cc:107
static edm::CPUTimer * _CPUtimer
std::map< std::string, double > _moduleTime
Times stop()
Definition: CPUTimer.cc:94
double cpuTime() const
Definition: CPUTimer.cc:157
double realTime() const
Definition: CPUTimer.cc:149
std::auto_ptr< HLTPerformanceInfo > _perfInfo
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(), AlCaRecoCosmics_cfg::name, and edm::HLTPathStatus::state().

Referenced by PathTimerService().

157  {
158  HLTPerformanceInfo::PathList::iterator iPath=_perfInfo->beginPaths();
159  int ctr = 0 ;
160  while ( iPath != _perfInfo->endPaths() ) {
161  if ( iPath->name() == name) {
162  unsigned int pIndex = _newPathIndex.at(ctr).at(status.index()) ;
163  iPath->setStatus(HLTPathStatus(status.state(),pIndex)) ;
164  _perfInfo->setStatusOfModulesFromPath(name.c_str());
165  }
166  iPath++;
167  ctr++;
168 
169  }
170 
171  }
std::vector< std::vector< unsigned int > > _newPathIndex
tuple status
Definition: ntuplemaker.py:245
std::auto_ptr< HLTPerformanceInfo > _perfInfo
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().

109  {
110  curr_event_ = iID;
112 
113  _perfInfo->clearModules();
114 
115  std::map<std::string, double>::iterator iter=_moduleTime.begin();
116  std::map<std::string, double>::iterator iCPU=_moduleCPUTime.begin();
117 
118  while ( iter != _moduleTime.end()) {
119  (*iter).second=0.;
120  iter++;
121  }
122  while ( iCPU != _moduleCPUTime.end()) {
123  (*iCPU).second=0.;
124  iCPU++;
125  }
126 
127  }
std::map< std::string, double > _moduleCPUTime
std::map< std::string, double > _moduleTime
static double getTime()
std::auto_ptr< HLTPerformanceInfo > _perfInfo
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().

132  {
133  _CPUtimer->reset() ;
134  _CPUtimer->start() ;
135  }
void start()
Definition: CPUTimer.cc:74
void reset()
Definition: CPUTimer.cc:107
static edm::CPUTimer * _CPUtimer

Member Data Documentation

edm::CPUTimer * edm::service::PathTimerService::_CPUtimer = 0
staticprivate

Definition at line 64 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 61 of file PathTimerService.h.

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

Definition at line 59 of file PathTimerService.h.

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

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

Definition at line 57 of file PathTimerService.h.

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

Definition at line 58 of file PathTimerService.h.

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

ParameterSet edm::service::PathTimerService::_myPS
private

Definition at line 56 of file PathTimerService.h.

Referenced by PathTimerService().

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

Definition at line 63 of file PathTimerService.h.

Referenced by postBeginJob(), and postPathProcessing().

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

Definition at line 60 of file PathTimerService.h.

Referenced by postBeginJob().

std::auto_ptr<HLTPerformanceInfo> edm::service::PathTimerService::_perfInfo
private
edm::EventID edm::service::PathTimerService::curr_event_
private

Definition at line 44 of file PathTimerService.h.

Referenced by preEventProcessing().

double edm::service::PathTimerService::curr_event_time_
private

Definition at line 46 of file PathTimerService.h.

Referenced by preEventProcessing().

double edm::service::PathTimerService::curr_job_
private

Definition at line 45 of file PathTimerService.h.

Referenced by postBeginJob().

double edm::service::PathTimerService::curr_module_time_
private

Definition at line 47 of file PathTimerService.h.

double edm::service::PathTimerService::max_event_time_
private

Definition at line 52 of file PathTimerService.h.

double edm::service::PathTimerService::min_event_time_
private

Definition at line 53 of file PathTimerService.h.

sigc::signal<void, const edm::ModuleDescription&, double> edm::service::PathTimerService::newMeasurementSignal

Definition at line 30 of file PathTimerService.h.

int edm::service::PathTimerService::total_event_count_
private

Definition at line 54 of file PathTimerService.h.

Referenced by postEventProcessing().