]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/Ref/AliHLTTPCStopwatch.h
Effective c++ corrections (T.Pocheptsov)
[u/mrichter/AliRoot.git] / HLT / TPCLib / Ref / AliHLTTPCStopwatch.h
CommitLineData
78001a73 1// @(#) $Id$
2
3#ifndef ALIHLTTPC_Stopwatch
4#define ALIHLTTPC_Stopwatch
5
6#ifndef no_root
7#include <TStopwatch.h>
8typedef TStopwatch AliHLTTPCStopwatch;
9
10#else
11#include <sys/types.h>
12#include <sys/times.h>
13#include <unistd.h>
14#include "AliHLTTPCRootTypes.h"
15
16class AliHLTTPCStopwatch
17{
18 private:
19 static clock_t gTicks;
20 enum EState { kUndefined, kStopped, kRunning };
21
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
30
31 public:
32
33 AliHLTTPCStopwatch();
34 ~AliHLTTPCStopwatch();
35 void Start(Bool_t reset = kTRUE);
36 void Stop();
37 void Continue();
38 Int_t Counter() const { return fCounter; }
39 Double_t RealTime();
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; }
43 Double_t CpuTime();
44 void Print(Char_t *opt="") const;
45 static Double_t GetRealTime();
46 static Double_t GetCPUTime();
47
48 ClassDef(TStopwatch,1) //A stopwatch which times real and cpu time
49};
50
51#endif
52
53#endif