CMS 3D CMS Logo

GenTimer< Time > Class Template Reference

a templated generic timer More...

#include <Utilities/Timing/interface/GenTimer.h>

List of all members.

Public Types

typedef Time::IntervalType IntervalType
typedef GenTimer< Time > self
typedef Time::TimeInterval TimeInterval

Public Member Functions

void forceStop ()
 GenTimer (int ipid)
 from known context
 GenTimer ()
 constructor
Time::TimeInterval lap () const
void reset ()
bool running () const
void start ()
void stop ()
 ~GenTimer ()
 destructor

Static Public Member Functions

static double bias (bool insec=true, unsigned int n=5000)
static double ticksInSec ()

Private Attributes

Time::IntervalType elapsed
int pid
int running_

Classes

struct  Bias


Detailed Description

template<class Time>
class GenTimer< Time >

a templated generic timer

Definition at line 51 of file GenTimer.h.


Member Typedef Documentation

template<class Time>
typedef Time::IntervalType GenTimer< Time >::IntervalType

Definition at line 54 of file GenTimer.h.

template<class Time>
typedef GenTimer<Time> GenTimer< Time >::self

Definition at line 56 of file GenTimer.h.

template<class Time>
typedef Time::TimeInterval GenTimer< Time >::TimeInterval

Definition at line 53 of file GenTimer.h.


Constructor & Destructor Documentation

template<class Time>
GenTimer< Time >::GenTimer (  )  [inline]

constructor

Definition at line 87 of file GenTimer.h.

00087 : elapsed(0),  running_(0), pid(0) {}

template<class Time>
GenTimer< Time >::GenTimer ( int  ipid  )  [inline]

from known context

Definition at line 89 of file GenTimer.h.

00089 : elapsed(0),  running_(0), pid(ipid) {}

template<class Time>
GenTimer< Time >::~GenTimer (  )  [inline]

destructor

Definition at line 92 of file GenTimer.h.

00092 {}


Member Function Documentation

template<class Time>
static double GenTimer< Time >::bias ( bool  insec = true,
unsigned int  n = 5000 
) [inline, static]

Definition at line 77 of file GenTimer.h.

References it, GenTimer< Time >::Bias::mes, GenTimer< Time >::Bias::met, and n.

Referenced by TimingReport::Item::cpusec().

00077                                                            {
00078     static Bias it(n);
00079     return insec ? it.mes : double(it.met) ;
00080   }

template<class Time>
void GenTimer< Time >::forceStop (  )  [inline]

Definition at line 115 of file GenTimer.h.

References GenTimer< Time >::running_, and GenTimer< Time >::stop().

00115                           {
00116     if (running_==0) return;
00117     running_ =1;
00118     stop();
00119   }

template<class Time>
Time::TimeInterval GenTimer< Time >::lap (  )  const [inline]

Definition at line 122 of file GenTimer.h.

References GenTimer< Time >::elapsed, GenTimer< Time >::pid, and GenTimer< Time >::running().

Referenced by GenTimer< Time >::Bias::Bias(), TimingReport::Item::cpusec(), TimeMe::lap(), and TimingReport::Item::stop().

00122                                                { 
00123     if (running()) return (elapsed+Time::time(pid));
00124     return elapsed;
00125   }

template<class Time>
void GenTimer< Time >::reset ( void   )  [inline]

Definition at line 98 of file GenTimer.h.

References GenTimer< Time >::elapsed, GenTimer< Time >::pid, and GenTimer< Time >::running().

00098                       { 
00099     if (running()) elapsed=-Time::time(pid);
00100     else elapsed=0;
00101   }

template<class Time>
bool GenTimer< Time >::running ( void   )  const [inline]

Definition at line 95 of file GenTimer.h.

References GenTimer< Time >::running_.

Referenced by GenTimer< Time >::lap(), and GenTimer< Time >::reset().

00095 { return running_>0;}

template<class Time>
void GenTimer< Time >::start ( void   )  [inline]

Definition at line 104 of file GenTimer.h.

References GenTimer< Time >::elapsed, GenTimer< Time >::pid, and GenTimer< Time >::running_.

Referenced by GenTimer< Time >::Bias::Bias(), and TimingReport::Item::start().

00104                       {
00105     running_++;
00106     if (running_==1) elapsed-=Time::time(pid);
00107   }

template<class Time>
void GenTimer< Time >::stop (  )  [inline]

Definition at line 110 of file GenTimer.h.

References GenTimer< Time >::elapsed, GenTimer< Time >::pid, and GenTimer< Time >::running_.

Referenced by GenTimer< Time >::Bias::Bias(), GenTimer< Time >::forceStop(), and TimingReport::Item::stop().

00110                       {
00111     if (running_==1) elapsed+=Time::time(pid);
00112     if (running_>0) running_--;
00113   }

template<class Time>
static double GenTimer< Time >::ticksInSec (  )  [inline, static]

Definition at line 83 of file GenTimer.h.

00083 { return Time::oneTick();}


Member Data Documentation

template<class Time>
Time::IntervalType GenTimer< Time >::elapsed [private]

Definition at line 129 of file GenTimer.h.

Referenced by GenTimer< Time >::lap(), GenTimer< Time >::reset(), GenTimer< Time >::start(), and GenTimer< Time >::stop().

template<class Time>
int GenTimer< Time >::pid [private]

Definition at line 131 of file GenTimer.h.

Referenced by GenTimer< Time >::lap(), GenTimer< Time >::reset(), GenTimer< Time >::start(), and GenTimer< Time >::stop().

template<class Time>
int GenTimer< Time >::running_ [private]

Definition at line 130 of file GenTimer.h.

Referenced by GenTimer< Time >::forceStop(), GenTimer< Time >::running(), GenTimer< Time >::start(), and GenTimer< Time >::stop().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:21:22 2009 for CMSSW by  doxygen 1.5.4