1 #ifndef ALIL3_Stopwatch
2 #define ALIL3_Stopwatch
5 #include <TStopwatch.h>
6 typedef TStopwatch AliL3Stopwatch;
10 #include <sys/times.h>
12 #include "AliL3RootTypes.h"
17 static clock_t gTicks;
18 enum EState { kUndefined, kStopped, kRunning };
20 Double_t fStartRealTime; //wall clock start time
21 Double_t fStopRealTime; //wall clock stop time
22 Double_t fStartCpuTime; //cpu start time
23 Double_t fStopCpuTime; //cpu stop time
24 Double_t fTotalCpuTime; //total cpu time
25 Double_t fTotalRealTime; //total real time
26 EState fState; //stopwatch state
27 Int_t fCounter; //number of times the stopwatch was started
33 void Start(Bool_t reset = kTRUE);
36 Int_t Counter() const { return fCounter; }
38 void Reset() { ResetCpuTime(); ResetRealTime(); }
39 void ResetCpuTime (Double_t time = 0) { Stop(); fTotalCpuTime = time; }
40 void ResetRealTime(Double_t time = 0) { Stop(); fTotalRealTime = time; }
42 void Print(Char_t *opt="") const;
43 static Double_t GetRealTime();
44 static Double_t GetCPUTime();
46 ClassDef(TStopwatch,1) //A stopwatch which times real and cpu time