3 #ifndef ALIL3_Stopwatch
4 #define ALIL3_Stopwatch
7 #include <TStopwatch.h>
8 typedef TStopwatch AliL3Stopwatch;
11 #include <sys/types.h>
12 #include <sys/times.h>
14 #include "AliL3RootTypes.h"
19 static clock_t gTicks;
20 enum EState { kUndefined, kStopped, kRunning };
22 Double_t fStartRealTime; //wall clock start time
23 Double_t fStopRealTime; //wall clock stop time
24 Double_t fStartCpuTime; //cpu start time
25 Double_t fStopCpuTime; //cpu stop time
26 Double_t fTotalCpuTime; //total cpu time
27 Double_t fTotalRealTime; //total real time
28 EState fState; //stopwatch state
29 Int_t fCounter; //number of times the stopwatch was started
35 void Start(Bool_t reset = kTRUE);
38 Int_t Counter() const { return fCounter; }
40 void Reset() { ResetCpuTime(); ResetRealTime(); }
41 void ResetCpuTime (Double_t time = 0) { Stop(); fTotalCpuTime = time; }
42 void ResetRealTime(Double_t time = 0) { Stop(); fTotalRealTime = time; }
44 void Print(Char_t *opt="") const;
45 static Double_t GetRealTime();
46 static Double_t GetCPUTime();
48 ClassDef(TStopwatch,1) //A stopwatch which times real and cpu time