22 # include <sys/times.h>
94 Error(
"Continue",
"stopwatch not started");
111 Error(
"RealTime",
"stopwatch not started");
126 Error(
"CpuTime",
"stopwatch not started");
148 SystemTimeToFileTime(&st,&ftRealTime.ftFileTime);
164 OSVERSIONINFO OsVersionInfo;
172 OsVersionInfo.dwOSVersionInfoSize=
sizeof(OSVERSIONINFO);
173 GetVersionEx(&OsVersionInfo);
174 if (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
189 HANDLE hThread = GetCurrentThread();
190 ret = GetThreadTimes (hThread, &ftCreate, &ftExit,
191 &ftKernel.ftFileTime,
194 ret = GetLastError ();
195 ::Error (
"GetCPUTime",
" Error on GetProcessTimes 0x%lx", (
int)ret);
223 realt -= hours * 3600;
228 if (realt < 0) realt = 0;
229 if (cput < 0) cput = 0;
231 if (opt && *opt ==
'm') {
233 Printf(
"Real time %d:%02d:%06.3f, CP time %.3f, %d slices", hours, min, realt, cput,
Counter());
235 Printf(
"Real time %d:%02d:%06.3f, CP time %.3f", hours, min, realt, cput);
237 }
else if (opt && *opt ==
'u') {
239 Printf(
"Real time %d:%02d:%09.6f, CP time %.3f, %d slices", hours, min, realt, cput,
Counter());
241 Printf(
"Real time %d:%02d:%09.6f, CP time %.3f", hours, min, realt, cput);
245 Printf(
"Real time %d:%02d:%02d, CP time %.3f, %d slices", hours, min, sec, cput,
Counter());
247 Printf(
"Real time %d:%02d:%02d, CP time %.3f", hours, min, sec, cput);
void Print(Option_t *option="") const
Print the real and cpu time passed between the start and stop events.
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
void Stop()
Stop the stopwatch.
ClassImp(TStopwatch) TStopwatch
Create a stopwatch and start it.
void Continue()
Resume a stopped stopwatch.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static Double_t GetCPUTime()
Private static method returning system CPU time.
static Double_t GetRealTime()
Private static method returning system realtime.
The TTimeStamp encapsulates seconds and ns since EPOCH.