CMS 3D CMS Logo

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

#include <TimerService.h>

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

hlt::CPUTimer cpu_timer
 
bool is_bound_
 
bool useCPUtime
 

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 80 of file TimerService.h.

Constructor & Destructor Documentation

TimerService::TimerService ( const edm::ParameterSet ps,
edm::ActivityRegistry iAR 
)

Definition at line 8 of file TimerService.cc.

References CPUAffinity::bindToCurrentCpu(), CPUAffinity::currentCpu(), is_bound_, postModule(), preModule(), useCPUtime, edm::ActivityRegistry::watchPostModule(), and edm::ActivityRegistry::watchPreModule().

9  :
10  useCPUtime( ps.getUntrackedParameter<bool>("useCPUtime", true) ),
12  is_bound_(false)
13 {
14  if (useCPUtime) {
16  if (is_bound_)
17  // the process is (now) bound to a single CPU, the call to clock_gettime(CLOCK_THREAD_CPUTIME_ID, ...) is safe to use
18  edm::LogInfo("TimerService") << "this process is bound to CPU " << CPUAffinity::currentCpu();
19  else
20  // the process is NOT bound to a single CPU
21  edm::LogError("TimerService") << "this process is NOT bound to a single CPU, the results of the TimerService may be undefined";
22  }
23 
26 }
void postModule(const edm::ModuleDescription &iMod)
Definition: TimerService.cc:47
T getUntrackedParameter(std::string const &, T const &) const
void preModule(const edm::ModuleDescription &iMod)
Definition: TimerService.cc:40
void watchPostModule(PostModule::slot_type const &iSlot)
void watchPreModule(PreModule::slot_type const &iSlot)
static int currentCpu()
Definition: CPUAffinity.cc:51
hlt::CPUTimer cpu_timer
Definition: TimerService.h:98
static bool bindToCurrentCpu()
Definition: CPUAffinity.cc:78
TimerService::~TimerService ( )

Definition at line 28 of file TimerService.cc.

References gather_cfg::cout, is_bound_, and useCPUtime.

29 {
30  if (useCPUtime and not is_bound_)
31  std::cout << "this process is NOT bound to a single CPU, the results of the TimerService may be undefined";
32  std::cout << "==========================================================\n";
33  std::cout << " TimerService Info:\n";
34  std::cout << " Used " << (useCPUtime ? "CPU" : "wall-clock") << "time for timing information\n";
35  std::cout << "==========================================================\n";
36  std::cout << std::flush;
37 }
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

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

Definition at line 47 of file TimerService.cc.

References cpu_timer, hlt::CPUTimer::delta(), newMeasurementSignal, hlt::CPUTimer::stop(), and cond::rpcobgas::time.

Referenced by TimerService().

48 {
49  cpu_timer.stop();
50  double time = cpu_timer.delta(); // in secs
51  newMeasurementSignal(iMod, time);
52 }
hlt::CPUTimer cpu_timer
Definition: TimerService.h:98
sigc::signal< void, const edm::ModuleDescription &, double > newMeasurementSignal
Definition: TimerService.h:86
double delta() const
Definition: TimerService.h:64
void TimerService::preModule ( const edm::ModuleDescription iMod)

Definition at line 40 of file TimerService.cc.

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

Referenced by TimerService().

41 {
42  cpu_timer.reset();
43  cpu_timer.start();
44 }
hlt::CPUTimer cpu_timer
Definition: TimerService.h:98

Member Data Documentation

hlt::CPUTimer TimerService::cpu_timer
private

Definition at line 98 of file TimerService.h.

Referenced by postModule(), and preModule().

bool TimerService::is_bound_
private

Definition at line 101 of file TimerService.h.

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

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

Definition at line 86 of file TimerService.h.

Referenced by postModule(), and Timer::Timer().

bool TimerService::useCPUtime
private

Definition at line 95 of file TimerService.h.

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