CMS 3D CMS Logo

Public Member Functions | Private Attributes

Timer Class Reference

#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(), self_module_name, and cond::rpcobgas::time.

{
  //  produces<EventTime>("Timing");
  produces<EventTime>();
  
  // whether to include timing info about Timer module (default: false)
  includeSelf = iConfig.getUntrackedParameter<bool>("includeSelf", false);

  timing.reset();

  // attach method to Timing service's "new measurement" signal
  Service<TimerService> time;
  time->newMeasurementSignal.connect(boost::bind(boost::mem_fn(&Timer::newTimingMeasurement), this, _1, _2) );
  
  self_module_name = string(iConfig.getParameter<string>("@module_type"));
}
Timer::~Timer ( )

Definition at line 52 of file Timer.cc.

References gather_cfg::cout, and includeSelf.

{
  using namespace std;

  if(!includeSelf){
    string longLine("=========================================================="); 
    cout << longLine << endl;
    cout << " Timer Info:\n";
    cout << " Timer module was excluded from time measurements\n";
    cout << " (to include, set 'bool includeSelf = true' in .cfg file)\n";
    cout << longLine << endl << endl;
  }

}

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

{
  // check if module name corresponds to "this" and skip if needed
  if(!includeSelf && iMod.moduleName() == self_module_name)
     return;

  // new measurement; add to private member
  ModuleTime newModuleTime(iMod.moduleLabel(), iTime); 
  timing.addModuleTime(newModuleTime);
}
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().

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

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

Definition at line 54 of file Timer.h.