/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Utilities/BesTimerSvc/BesTimerSvc-00-00-12/BesTimerSvc/BesTimer.h

Go to the documentation of this file.
00001 // this is -*- c++ -*-
00002 // $Id: BesTimer.h,v 1.3 2011/02/18 04:23:58 maqm Exp $
00003 // $Name: BesTimerSvc-00-00-12 $
00004 #ifndef BesTIMER_H_
00005 #define BesTIMER_H_
00006 #include <sys/time.h>
00007 #include <iostream>
00008 #include <string>
00009 
00010 #include   <complex>
00011 
00012 
00013   class BesTimer {
00014   public:
00015     // constructor
00016     BesTimer (const std::string name);
00017     
00018   public:
00019     
00020     // retrieve timer name
00021     std::string& name() { return m_name; }
00022     // retrieve elapsed time
00023     float elapsed( void ) const { return (m_started? 0.0 : m_elapsed);}
00024     // retrieve mean and rms time
00025     double mean( void ) const { return m_mean;}
00026     double rms( void ) const { 
00027       double var = m_ms - m_mean*m_mean;
00028       return (var > 0 ? sqrt(var) : 0.0);
00029     }
00030     // retrieve number of measurements 
00031     int number_of_measurements( void ) const { return m_numberOfMeasurements;}
00032 
00033     // set and retrieve property name
00034     void propName(std::string name) { m_propName = name; }
00035     std::string& propName() { return m_propName; }
00036     // set and retrieve property value
00037     inline unsigned int propVal() { return m_propVal;}
00038     inline void propVal(unsigned int val) { m_propVal = val; } 
00039 
00040     double meanPropVal() { return m_meanVal;}
00041     double meanTimePerObject() { return m_meanTimePerObject;}
00042 
00043     // define less than operator based on name
00044     bool operator < ( BesTimer &it) { return (this->name() < it.name());}
00045 
00046     // methods to control clock
00047     void start( void );    
00048     void stop ( void ); 
00049     void pause ( void );
00050     void resume( void );
00051     void reset ();
00052 
00053 
00054   private:
00055     std::string m_name;
00056     struct timeval m_startTime;
00057     float m_elapsed;
00058     double m_mean; // mean time
00059     double m_ms;   // mean squared time
00060     int m_numberOfMeasurements;
00061     bool m_started;
00062     bool m_paused;
00063     std::string m_propName;
00064     unsigned int m_propVal; 
00065     double m_meanVal;
00066     double m_meanTimePerObject;
00067     int  m_NmeanTimePerObject;
00068 
00069   };
00070 
00071 #endif // BesTIMER_H

Generated on Tue Nov 29 23:14:42 2016 for BOSS_7.0.2 by  doxygen 1.4.7