CMS 3D CMS Logo

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

#include <TimeProfilerService.h>

Classes

struct  times
 

Public Member Functions

double getAve (std::string const &name) const
 
double getFirst (std::string const &name) const
 
double getMax (std::string const &name) const
 
void postBeginJob ()
 
void postEndJob ()
 
void postEventProcessing (const edm::Event &, const edm::EventSetup &)
 
void postModule (const edm::ModuleDescription &)
 
void postSource ()
 
void preEventProcessing (const edm::EventID &, const edm::Timestamp &)
 
void preModule (const edm::ModuleDescription &)
 
void preSource ()
 
 TimeProfilerService (const edm::ParameterSet &, edm::ActivityRegistry &)
 
 ~TimeProfilerService ()
 

Private Attributes

double curr_module_time_
 
boost::mutex lock_
 
std::map< std::string, timesprofiles_
 

Detailed Description

Definition at line 20 of file TimeProfilerService.h.

Constructor & Destructor Documentation

evf::TimeProfilerService::TimeProfilerService ( const edm::ParameterSet iPS,
edm::ActivityRegistry iRegistry 
)

Definition at line 15 of file TimeProfilerService.cc.

References postBeginJob(), postEndJob(), postEventProcessing(), postModule(), preEventProcessing(), preModule(), edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPostProcessEvent(), edm::ActivityRegistry::watchPreModule(), and edm::ActivityRegistry::watchPreProcessEvent().

16  {
19 
22 
25  }
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void watchPostModule(PostModule::slot_type const &iSlot)
void watchPreProcessEvent(PreProcessEvent::slot_type const &iSlot)
void watchPreModule(PreModule::slot_type const &iSlot)
void postEventProcessing(const edm::Event &, const edm::EventSetup &)
void watchPostProcessEvent(PostProcessEvent::slot_type const &iSlot)
void preEventProcessing(const edm::EventID &, const edm::Timestamp &)
void postModule(const edm::ModuleDescription &)
void preModule(const edm::ModuleDescription &)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
evf::TimeProfilerService::~TimeProfilerService ( )

Definition at line 27 of file TimeProfilerService.cc.

28  {}

Member Function Documentation

double evf::TimeProfilerService::getAve ( std::string const &  name) const

Definition at line 83 of file TimeProfilerService.cc.

References profiles_.

Referenced by evf::FWEPWrapper::taskWebPage().

84  {
85  std::map<std::string, times>::const_iterator it = profiles_.find(name);
86 
87  if(it == profiles_.end())
88  return -1.;
89  return (*it).second.total_/(*it).second.ncalls_;
90  }
std::map< std::string, times > profiles_
double evf::TimeProfilerService::getFirst ( std::string const &  name) const

Definition at line 65 of file TimeProfilerService.cc.

References profiles_.

Referenced by evf::FWEPWrapper::taskWebPage().

66  {
67  std::map<std::string, times>::const_iterator it = profiles_.find(name);
68 
69  if(it==profiles_.end())
70  return -1.;
71  return (*it).second.firstEvent_;
72  }
std::map< std::string, times > profiles_
double evf::TimeProfilerService::getMax ( std::string const &  name) const

Definition at line 74 of file TimeProfilerService.cc.

References profiles_.

Referenced by evf::FWEPWrapper::taskWebPage().

75  {
76  std::map<std::string, times>::const_iterator it = profiles_.find(name);
77 
78  if(it == profiles_.end())
79  return -1.;
80  return (*it).second.max_;
81  }
std::map< std::string, times > profiles_
void evf::TimeProfilerService::postBeginJob ( )

Definition at line 30 of file TimeProfilerService.cc.

Referenced by TimeProfilerService().

31  {}
void evf::TimeProfilerService::postEndJob ( )

Definition at line 33 of file TimeProfilerService.cc.

Referenced by TimeProfilerService().

34  {}
void evf::TimeProfilerService::postEventProcessing ( const edm::Event e,
const edm::EventSetup  
)

Definition at line 38 of file TimeProfilerService.cc.

Referenced by TimeProfilerService().

39  {}
void evf::TimeProfilerService::postModule ( const edm::ModuleDescription desc)

Definition at line 45 of file TimeProfilerService.cc.

References curr_module_time_, evf::TimeProfilerService::times::firstEvent_, evf::getTime(), evf::TimeProfilerService::times::max_, edm::ModuleDescription::moduleLabel(), evf::TimeProfilerService::times::ncalls_, profiles_, lumiQTWidget::t, evf::TimeProfilerService::times::total_, and groupFilesInBlocks::tt.

Referenced by TimeProfilerService().

46  {
47  double t = getTime() - curr_module_time_;
48  std::map<std::string, times>::iterator it = profiles_.find(desc.moduleLabel());
49  if(it==profiles_.end())
50  {
51  times tt;
52  tt.ncalls_ = 0;
53  tt.total_ = 0.;
54  tt.max_ = 0.;
55  tt.firstEvent_ = t;
56  profiles_.insert(std::pair<std::string, times>(desc.moduleLabel(),tt));
57  }
58  else
59  {
60  (*it).second.ncalls_++;
61  (*it).second.total_ += t;
62  (*it).second.max_ = ((*it).second.max_ > t) ? (*it).second.max_ : t;
63  }
64  }
std::string const & moduleLabel() const
static double getTime()
std::map< std::string, times > profiles_
void evf::TimeProfilerService::postSource ( )
void evf::TimeProfilerService::preEventProcessing ( const edm::EventID iID,
const edm::Timestamp iTime 
)

Definition at line 35 of file TimeProfilerService.cc.

Referenced by TimeProfilerService().

37  {}
void evf::TimeProfilerService::preModule ( const edm::ModuleDescription )

Definition at line 40 of file TimeProfilerService.cc.

References curr_module_time_, and evf::getTime().

Referenced by TimeProfilerService().

41  {
43  }
static double getTime()
void evf::TimeProfilerService::preSource ( )

Member Data Documentation

double evf::TimeProfilerService::curr_module_time_
private

Definition at line 45 of file TimeProfilerService.h.

Referenced by postModule(), and preModule().

boost::mutex evf::TimeProfilerService::lock_
private

Definition at line 44 of file TimeProfilerService.h.

std::map<std::string, times> evf::TimeProfilerService::profiles_
private

Definition at line 52 of file TimeProfilerService.h.

Referenced by getAve(), getFirst(), getMax(), and postModule().