File indexing completed on 2025-12-15 10:30:20
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TStopwatch
0013 #define ROOT_TStopwatch
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include "TObject.h"
0026
0027
0028 class TStopwatch : public TObject {
0029
0030 private:
0031 enum EState { kUndefined, kStopped, kRunning };
0032
0033 Double_t fStartRealTime;
0034 Double_t fStopRealTime;
0035 Double_t fStartCpuTime;
0036 Double_t fStopCpuTime;
0037 Double_t fTotalCpuTime;
0038 Double_t fTotalRealTime;
0039 EState fState;
0040 Int_t fCounter;
0041
0042 static Double_t GetRealTime();
0043 static Double_t GetCPUTime();
0044
0045 public:
0046 TStopwatch();
0047 void Start(Bool_t reset = kTRUE);
0048 void Stop();
0049 void Continue();
0050 Int_t Counter() const { return fCounter; }
0051 Double_t RealTime();
0052 void Reset() { ResetCpuTime(); ResetRealTime(); }
0053 void ResetCpuTime(Double_t time = 0) { Stop(); fTotalCpuTime = time; }
0054 void ResetRealTime(Double_t time = 0) { Stop(); fTotalRealTime = time; }
0055 Double_t CpuTime();
0056 void Print(Option_t *option="") const override;
0057
0058 ClassDefOverride(TStopwatch,1)
0059 };
0060
0061 #endif