CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | 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 ()
 

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

Constructor & Destructor Documentation

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

Definition at line 37 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().

37  :
40  {
41  iRegistry.watchPostBeginJob(this,&PathTimerService::postBeginJob);
42  iRegistry.watchPostEndJob(this,&PathTimerService::postEndJob);
43 
44  iRegistry.watchPreProcessEvent(this,&PathTimerService::preEventProcessing);
45  iRegistry.watchPostProcessEvent(this,&PathTimerService::postEventProcessing);
46 
47  iRegistry.watchPreModule(this,&PathTimerService::preModule);
48  iRegistry.watchPostModule(this,&PathTimerService::postModule);
49 
50  iRegistry.watchPostProcessPath(this,&PathTimerService::postPathProcessing);
51 
52  _myPS=iPS;
53 
54  if (!_CPUtimer) _CPUtimer = new edm::CPUTimer();
55  }
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 58 of file PathTimerService.cc.

References _CPUtimer.

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

Member Function Documentation

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

Definition at line 28 of file PathTimerService.h.

References _perfInfo.

Referenced by PathTimerInserter::produce().

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

Definition at line 66 of file PathTimerService.cc.

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

Referenced by PathTimerService().

66  {
67 
69  std::vector<std::string> trigPaths= tns->getTrigPaths();
70  for ( unsigned int i=0; i<trigPaths.size(); i++) {
71  _pathMapping[i]=trigPaths[i];
72  HLTPerformanceInfo::Path hltPath(trigPaths[i]);
73  std::vector<unsigned int> loc ;
74  const std::vector<std::string> modules=tns->getTrigPathModules(trigPaths[i]);
75  unsigned int mIdx = 0 ;
76  _perfInfo->addPath(hltPath);
77  for ( unsigned int j=0; j<modules.size(); j++) {
78  _moduleTime[modules[j]]=0. ;
79  _moduleCPUTime[modules[j]]=0. ;
80  HLTPerformanceInfo::Modules::const_iterator iMod =
81  _perfInfo->findModule(modules[j].c_str());
82  if ( iMod == _perfInfo->endModules() ) {
83  HLTPerformanceInfo::Module hltModule(modules[j].c_str(),0.,0.,hlt::Ready);
84  _perfInfo->addModule(hltModule);
85  }
86 
87  //--- Check the module frequency in the path ---//
88  bool duplicateModule = false ;
89  for (unsigned int k=0; k<j; k++) {
90  if (modules[k] == modules[j]) {
91  if (!duplicateModule) loc.push_back(k) ;
92  duplicateModule = true ;
93  }
94  }
95  if (!duplicateModule) {
96  _perfInfo->addModuleToPath(modules[j].c_str(),trigPaths[i].c_str());
97  loc.push_back(mIdx++) ;
98  }
99  }
100  _newPathIndex.push_back(loc) ;
101  }
102  curr_job_ = getTime();
103  }
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:18
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()
volatile std::atomic< bool > shutdown_flag false
std::auto_ptr< HLTPerformanceInfo > _perfInfo
void edm::service::PathTimerService::postEndJob ( )
private

Definition at line 105 of file PathTimerService.cc.

Referenced by PathTimerService().

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

Definition at line 127 of file PathTimerService.cc.

References total_event_count_.

Referenced by PathTimerService().

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

Definition at line 136 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().

136  {
137 
138  _CPUtimer->stop() ;
139  double tWall = _CPUtimer->realTime() ;
140  double tCPU = _CPUtimer->cpuTime() ;
141  _CPUtimer->reset() ;
142 
143  _moduleTime[desc.moduleLabel()] = tWall ;
144  _moduleCPUTime[desc.moduleLabel()] = tCPU ;
145 
146  HLTPerformanceInfo::Modules::iterator iMod =
147  _perfInfo->findModule(desc.moduleLabel().c_str());
148  if ( iMod != _perfInfo->endModules() ) {
149  iMod->setTime(tWall) ;
150  iMod->setCPUTime(tCPU) ;
151  }
152 
153  }
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:158
double realTime() const
Definition: CPUTimer.cc:150
std::auto_ptr< HLTPerformanceInfo > _perfInfo
void edm::service::PathTimerService::postPathProcessing ( const std::string &  name,
const HLTPathStatus status 
)
private

Definition at line 155 of file PathTimerService.cc.

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

Referenced by PathTimerService().

156  {
157  HLTPerformanceInfo::PathList::iterator iPath=_perfInfo->beginPaths();
158  int ctr = 0 ;
159  while ( iPath != _perfInfo->endPaths() ) {
160  if ( iPath->name() == name) {
161  unsigned int pIndex = _newPathIndex.at(ctr).at(status.index()) ;
162  iPath->setStatus(HLTPathStatus(status.state(),pIndex)) ;
163  _perfInfo->setStatusOfModulesFromPath(name.c_str());
164  }
165  iPath++;
166  ctr++;
167 
168  }
169 
170  }
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 107 of file PathTimerService.cc.

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

Referenced by PathTimerService().

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

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

Referenced by PathTimerService().

131  {
132  _CPUtimer->reset() ;
133  _CPUtimer->start() ;
134  }
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 60 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 57 of file PathTimerService.h.

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

Definition at line 55 of file PathTimerService.h.

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

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

Definition at line 53 of file PathTimerService.h.

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

Definition at line 54 of file PathTimerService.h.

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

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

Definition at line 52 of file PathTimerService.h.

Referenced by PathTimerService().

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

Definition at line 59 of file PathTimerService.h.

Referenced by postBeginJob(), and postPathProcessing().

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

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

Referenced by preEventProcessing().

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

Definition at line 42 of file PathTimerService.h.

Referenced by preEventProcessing().

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

Definition at line 41 of file PathTimerService.h.

Referenced by postBeginJob().

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

Definition at line 43 of file PathTimerService.h.

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

Definition at line 48 of file PathTimerService.h.

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

Definition at line 49 of file PathTimerService.h.

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

Definition at line 50 of file PathTimerService.h.

Referenced by postEventProcessing().