CMS 3D CMS Logo

Timer Class Reference

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

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

Inheritance diagram for Timer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void newTimingMeasurement (const edm::ModuleDescription &iMod, double iTime)
virtual void produce (edm::Event &, const edm::EventSetup &)
 Timer (const edm::ParameterSet &)
 ~Timer ()

Private Attributes

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


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, newTimingMeasurement(), and self_module_name.

00036 {
00037   //  produces<EventTime>("Timing");
00038   produces<EventTime>();
00039   
00040   // whether to include timing info about Timer module (default: false)
00041   includeSelf = iConfig.getUntrackedParameter<bool>("includeSelf", false);
00042 
00043   timing.reset();
00044 
00045   // attach method to Timing service's "new measurement" signal
00046   Service<TimerService> time;
00047   time->newMeasurementSignal.connect(boost::bind(boost::mem_fn(&Timer::newTimingMeasurement), this, _1, _2) );
00048   
00049   self_module_name = string(iConfig.getParameter<string>("@module_type"));
00050 }

Timer::~Timer (  ) 

Definition at line 52 of file Timer.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), includeSelf, and std.

00053 {
00054   using namespace std;
00055 
00056   if(!includeSelf){
00057     string longLine("=========================================================="); 
00058     cout << longLine << endl;
00059     cout << " Timer Info:\n";
00060     cout << " Timer module was excluded from time measurements\n";
00061     cout << " (to include, set 'bool includeSelf = true' in .cfg file)\n";
00062     cout << longLine << endl << endl;
00063   }
00064 
00065 }


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

00069 {
00070   // check if module name corresponds to "this" and skip if needed
00071   if(!includeSelf && iMod.moduleName() == self_module_name)
00072      return;
00073 
00074   // new measurement; add to private member
00075   ModuleTime newModuleTime(iMod.moduleLabel(), iTime); 
00076   timing.addModuleTime(newModuleTime);
00077 }

void Timer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 86 of file Timer.cc.

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

00087 {
00088   std::auto_ptr<EventTime> out(new EventTime(timing));
00089   // reset data so that we can start from scratch for next event
00090    timing.reset();
00091    //
00092    iEvent.put(out);
00093 }


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.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:28 2009 for CMSSW by  doxygen 1.5.4