CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
GenTimer< Time > Class Template Reference

#include <GenTimer.h>

Classes

struct  Bias
 

Public Types

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

Public Member Functions

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

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_
 

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.

87 : elapsed(0), running_(0), pid(0) {}
Time::IntervalType elapsed
Definition: GenTimer.h:129
int running_
Definition: GenTimer.h:130
int pid
Definition: GenTimer.h:131
template<class Time>
GenTimer< Time >::GenTimer ( int  ipid)
inline

from known context

Definition at line 89 of file GenTimer.h.

89 : elapsed(0), running_(0), pid(ipid) {}
Time::IntervalType elapsed
Definition: GenTimer.h:129
int running_
Definition: GenTimer.h:130
int pid
Definition: GenTimer.h:131
template<class Time>
GenTimer< Time >::~GenTimer ( )
inline

destructor

Definition at line 92 of file GenTimer.h.

92 {}

Member Function Documentation

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

Definition at line 77 of file GenTimer.h.

77  {
78  static Bias it(n);
79  return insec ? it.mes : double(it.met) ;
80  }
template<class Time>
void GenTimer< Time >::forceStop ( )
inline

Definition at line 115 of file GenTimer.h.

115  {
116  if (running_==0) return;
117  running_ =1;
118  stop();
119  }
int running_
Definition: GenTimer.h:130
void stop()
Definition: GenTimer.h:110
template<class Time>
Time::TimeInterval GenTimer< Time >::lap ( ) const
inline

Definition at line 122 of file GenTimer.h.

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

122  {
123  if (running()) return (elapsed+Time::time(pid));
124  return elapsed;
125  }
Time::IntervalType elapsed
Definition: GenTimer.h:129
bool running() const
Definition: GenTimer.h:95
int pid
Definition: GenTimer.h:131
template<class Time>
void GenTimer< Time >::reset ( void  )
inline

Definition at line 98 of file GenTimer.h.

98  {
99  if (running()) elapsed=-Time::time(pid);
100  else elapsed=0;
101  }
Time::IntervalType elapsed
Definition: GenTimer.h:129
bool running() const
Definition: GenTimer.h:95
int pid
Definition: GenTimer.h:131
template<class Time>
bool GenTimer< Time >::running ( ) const
inline

Definition at line 95 of file GenTimer.h.

Referenced by TimingReport::Item::active(), GenTimer< PentiumTime >::lap(), and GenTimer< PentiumTime >::reset().

95 { return running_>0;}
int running_
Definition: GenTimer.h:130
template<class Time>
void GenTimer< Time >::start ( void  )
inline

Definition at line 104 of file GenTimer.h.

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

104  {
105  running_++;
106  if (running_==1) elapsed-=Time::time(pid);
107  }
Time::IntervalType elapsed
Definition: GenTimer.h:129
int running_
Definition: GenTimer.h:130
int pid
Definition: GenTimer.h:131
template<class Time>
void GenTimer< Time >::stop ( )
inline

Definition at line 110 of file GenTimer.h.

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

110  {
111  if (running_==1) elapsed+=Time::time(pid);
112  if (running_>0) running_--;
113  }
Time::IntervalType elapsed
Definition: GenTimer.h:129
int running_
Definition: GenTimer.h:130
int pid
Definition: GenTimer.h:131
template<class Time>
static double GenTimer< Time >::ticksInSec ( )
inlinestatic

Definition at line 83 of file GenTimer.h.

83 { return Time::oneTick();}

Member Data Documentation

template<class Time>
Time::IntervalType GenTimer< Time >::elapsed
private
template<class Time>
int GenTimer< Time >::pid
private
template<class Time>
int GenTimer< Time >::running_
private