CMS 3D CMS Logo

TimerService Class Reference

Description: Class accessing CPUTimer to record processing-time info per module (either CPU-time or wall-clock-time). More...

#include <HLTrigger/Timer/interface/TimerService.h>

List of all members.

Public Member Functions

void postModule (const edm::ModuleDescription &iMod)
void preModule (const edm::ModuleDescription &iMod)
 TimerService (const edm::ParameterSet &, edm::ActivityRegistry &iAR)
 ~TimerService ()

Public Attributes

sigc::signal< void, const
edm::ModuleDescription &,
double > 
newMeasurementSignal

Private Attributes

bool useCPUtime

Static Private Attributes

static edm::CPUTimercpu_timer = 0


Detailed Description

Description: Class accessing CPUTimer to record processing-time info per module (either CPU-time or wall-clock-time).

Original Author: Christos Leonidopoulos, March 2007

Definition at line 24 of file TimerService.h.


Constructor & Destructor Documentation

TimerService::TimerService ( const edm::ParameterSet ps,
edm::ActivityRegistry iAR 
) [explicit]

Definition at line 6 of file TimerService.cc.

References cpu_timer, edm::ParameterSet::getUntrackedParameter(), postModule(), preModule(), useCPUtime, edm::ActivityRegistry::watchPostModule(), and edm::ActivityRegistry::watchPreModule().

00008 {
00009   // whether to use CPU-time (default) or wall-clock time
00010   useCPUtime = ps.getUntrackedParameter<bool>("useCPUtime", true);
00011 
00012   iAR.watchPreModule(this, &TimerService::preModule);
00013   iAR.watchPostModule(this, &TimerService::postModule);
00014   
00015   if(!cpu_timer)
00016     cpu_timer = new edm::CPUTimer();
00017 
00018 }

TimerService::~TimerService (  ) 

Definition at line 20 of file TimerService.cc.

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

00021 {
00022   if(cpu_timer){
00023     using namespace std;
00024 
00025     string longLine("=========================================================="); 
00026     cout << longLine << endl;
00027     cout << " TimerService Info:\n";
00028     
00029     if(useCPUtime)
00030       cout << " Used CPU-time ";
00031     else
00032       cout << " Used wall-clock-time ";
00033     cout << "for timing information " << endl;
00034     cout << longLine << endl;
00035     
00036     delete cpu_timer; cpu_timer = 0;
00037   }
00038 }


Member Function Documentation

void TimerService::postModule ( const edm::ModuleDescription iMod  ) 

Definition at line 48 of file TimerService.cc.

References cpu_timer, edm::CPUTimer::cpuTime(), newMeasurementSignal, edm::CPUTimer::realTime(), edm::CPUTimer::stop(), and useCPUtime.

Referenced by TimerService().

00049 {
00050   cpu_timer->stop();
00051 
00052   double time = -999; // in secs
00053   if(useCPUtime)
00054     time = cpu_timer->cpuTime();
00055   else
00056     time = cpu_timer->realTime();
00057 
00058   newMeasurementSignal(iMod, time);
00059 }

void TimerService::preModule ( const edm::ModuleDescription iMod  ) 

Definition at line 41 of file TimerService.cc.

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

Referenced by TimerService().

00042 {
00043   cpu_timer->reset();
00044   cpu_timer->start();  
00045 }


Member Data Documentation

edm::CPUTimer * TimerService::cpu_timer = 0 [static, private]

Definition at line 39 of file TimerService.h.

Referenced by postModule(), preModule(), TimerService(), and ~TimerService().

sigc::signal<void, const edm::ModuleDescription&, double> TimerService::newMeasurementSignal

Definition at line 30 of file TimerService.h.

Referenced by postModule().

bool TimerService::useCPUtime [private]

Definition at line 41 of file TimerService.h.

Referenced by postModule(), TimerService(), and ~TimerService().


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