00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef UT_CumulativeTimer_H
00020 #define UT_CumulativeTimer_H
00021
00022 #include "UT_String.h"
00023 #include "UT_SpinLock.h"
00024 #include "UT_StopWatch.h"
00025 #include "UT_ThreadSpecificValue.h"
00026
00027
00028 class UT_API UT_CumulativeTimer
00029 {
00030 public:
00031 UT_CumulativeTimer(const char *name, bool report_on_destroy = false);
00032 ~UT_CumulativeTimer();
00033
00034
00035 void reportWhenDestroyed(bool report = true);
00036
00037
00038
00039 void start();
00040 void stop();
00041
00042
00043 void reset();
00044
00045 const char *getName() const;
00046
00047
00048 double getTime() const;
00049
00050
00051 double getOverlapTime() const;
00052
00053
00054
00055 double getTotalTime() const;
00056
00057 private:
00058 UT_String myName;
00059
00060
00061 UT_ThreadSpecificValue<UT_StopWatch> myTimer;
00062 UT_ThreadSpecificValue<int> myRunning;
00063 UT_StopWatch myOverlapTimer;
00064 UT_StopWatch myTotalTimer;
00065
00066
00067 UT_SpinLock myLock;
00068
00069
00070 double myTime;
00071 double myOverlapTime;
00072 double myTotalTime;
00073 int myTimingCount;
00074 bool myReportOnDestroy;
00075 };
00076
00077
00078 #endif