00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef XRDMONTIMER_HH
00014 #define XRDMONTIMER_HH
00015
00016 #include "sys/time.h"
00017
00018 class XrdMonTimer {
00019 public:
00020 XrdMonTimer() { reset(); }
00021
00022 inline void reset();
00023
00024
00025 inline int start();
00026 inline double stop();
00027 inline double getElapsed() const;
00028
00029 void printElapsed(const char* str);
00030
00031 void printAll() const;
00032
00033 private:
00034
00035 inline void resetTBeg();
00036 inline void resetTElapsed();
00037
00038 inline double calcElapsed();
00039
00040
00041 inline int timerOn() const;
00042 inline int isOn(const struct timeval& t) const;
00043
00044 inline double calcDif(const struct timeval& start,
00045 const struct timeval& stop) const;
00046
00047 void printOne(const timeval& t, const char* prefix=0) const;
00048
00049 double convert2Double(const timeval& t) const;
00050
00051 private:
00052 struct timeval _tbeg;
00053 double _elapsed;
00054
00055 };
00056
00057 #include "XrdMonTimer.icc"
00058
00059
00060 #endif
00061