CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TimerStack.cc
Go to the documentation of this file.
2 void TimerStack::push( std::string name, Type type ){
3  bool linuxCpuOn = (type == DetailedMonitoring);
4  if( (*TimingReport::current())["firstcall_"+name].counter == 0)
5  stack.push(new TimeMe("firstcall_"+name,linuxCpuOn));
6  else
7  stack.push(new TimeMe(name,linuxCpuOn));
8 }
9 
11  bool linuxCpuOn = (type == DetailedMonitoring);
12  if( timer.first().counter == 0)
13  stack.push(new TimeMe(timer.first(), linuxCpuOn));
14  else
15  stack.push(new TimeMe(timer.main(), linuxCpuOn));
16 }
17 
19  if (!stack.empty()) {
20  delete stack.top();
21  stack.pop();
22  }
23 }
24 
26  while(!stack.empty()) pop();
27 }
28 
29 void TimerStack::pop_and_push(std::string name, Type type ) {
30  pop();
31  push(name,type);
32 }
34  pop();
35  push(timer,type);
36 }
37 
38 void TimerStack::benchmark( std::string name, int n )
39 {
40  push(name,FastMonitoring);
41  float a(1.0009394);
42  float b(0.000123);
43  for(int i=0; i < n; i++) b *= a;
44  pop();
45 }
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
void pop_and_push(std::string name, Type type=FastMonitoring)
Definition: TimerStack.cc:29
TTimer is a container for a timer name and associated timers (TimeReport::Item&#39;s) ...
Definition: TimerStack.h:38
TimingReport::Item & first()
Definition: TimerStack.h:44
void clear_stack()
stop all timers in the stack and clear it.
Definition: TimerStack.cc:25
void benchmark(std::string name, int n=1000000)
measure time to perform a number of floating point multiplications (FLOPs)
Definition: TimerStack.cc:38
void pop()
stop the last timer and remove it from the stack
Definition: TimerStack.cc:18
std::stack< TimeMe * > stack
Definition: TimerStack.h:78
static TimingReport * current()
Definition: TimingReport.cc:21
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
void push(std::string name, Type type=FastMonitoring)
start a timer and add it to the stack
Definition: TimerStack.cc:2
TimingReport::Item & main()
Definition: TimerStack.h:45