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 Attributes
Timer Class Reference

#include <HLTrigger/Timer/src/Timer.cc>

Inheritance diagram for Timer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

void newTimingMeasurement (const edm::ModuleDescription &iMod, double iTime)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 Timer (const edm::ParameterSet &)
 
 ~Timer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

bool includeSelf
 
std::string self_module_name
 
edm::EventTime timing
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Description: EDProducer that uses the EventTime structure to store in the Event the names and processing times (per event) for all modules.

Implementation: <Notes on="" implementation>="">

Definition at line 43 of file Timer.h.

Constructor & Destructor Documentation

Timer::Timer ( const edm::ParameterSet iConfig)
explicit

Definition at line 35 of file Timer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), includeSelf, TimerService::newMeasurementSignal, newTimingMeasurement(), self_module_name, and cond::rpcobgas::time.

36 {
37  // produces<EventTime>("Timing");
38  produces<EventTime>();
39 
40  // whether to include timing info about Timer module (default: false)
41  includeSelf = iConfig.getUntrackedParameter<bool>("includeSelf", false);
42 
43  timing.reset();
44 
45  // attach method to Timing service's "new measurement" signal
47  time->newMeasurementSignal.connect(boost::bind(boost::mem_fn(&Timer::newTimingMeasurement), this, _1, _2) );
48 
49  self_module_name = string(iConfig.getParameter<string>("@module_type"));
50 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string self_module_name
Definition: Timer.h:59
void newTimingMeasurement(const edm::ModuleDescription &iMod, double iTime)
Definition: Timer.cc:68
sigc::signal< void, const edm::ModuleDescription &, double > newMeasurementSignal
Definition: TimerService.h:86
bool includeSelf
Definition: Timer.h:56
Timer::~Timer ( )

Definition at line 52 of file Timer.cc.

References gather_cfg::cout, and includeSelf.

53 {
54  using namespace std;
55 
56  if(!includeSelf){
57  string longLine("==========================================================");
58  cout << longLine << endl;
59  cout << " Timer Info:\n";
60  cout << " Timer module was excluded from time measurements\n";
61  cout << " (to include, set 'bool includeSelf = true' in .cfg file)\n";
62  cout << longLine << endl << endl;
63  }
64 
65 }
tuple cout
Definition: gather_cfg.py:121
bool includeSelf
Definition: Timer.h:56

Member Function Documentation

void Timer::newTimingMeasurement ( const edm::ModuleDescription iMod,
double  iTime 
)

Definition at line 68 of file Timer.cc.

References includeSelf, edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and self_module_name.

Referenced by Timer().

69 {
70  // check if module name corresponds to "this" and skip if needed
71  if(!includeSelf && iMod.moduleName() == self_module_name)
72  return;
73 
74  // new measurement; add to private member
75  ModuleTime newModuleTime(iMod.moduleLabel(), iTime);
76  timing.addModuleTime(newModuleTime);
77 }
std::string const & moduleName() const
std::string const & moduleLabel() const
std::string self_module_name
Definition: Timer.h:59
bool includeSelf
Definition: Timer.h:56
void Timer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 86 of file Timer.cc.

References dbtoconf::out, and edm::Event::put().

87 {
88  std::auto_ptr<EventTime> out(new EventTime(timing));
89  // reset data so that we can start from scratch for next event
90  timing.reset();
91  //
92  iEvent.put(out);
93 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
tuple out
Definition: dbtoconf.py:99

Member Data Documentation

bool Timer::includeSelf
private

Definition at line 56 of file Timer.h.

Referenced by newTimingMeasurement(), Timer(), and ~Timer().

std::string Timer::self_module_name
private

Definition at line 59 of file Timer.h.

Referenced by newTimingMeasurement(), and Timer().

edm::EventTime Timer::timing
private

Definition at line 54 of file Timer.h.