24# include <sys/times.h>
96 Error(
"Continue",
"stopwatch not started");
113 Error(
"RealTime",
"stopwatch not started");
128 Error(
"CpuTime",
"stopwatch not started");
150 SystemTimeToFileTime(&st,&ftRealTime.ftFileTime);
166 OSVERSIONINFO OsVersionInfo;
174 OsVersionInfo.dwOSVersionInfoSize=
sizeof(OSVERSIONINFO);
175 GetVersionEx(&OsVersionInfo);
176 if (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
191 HANDLE hThread = GetCurrentThread();
192 ret = GetThreadTimes (hThread, &ftCreate, &ftExit,
193 &ftKernel.ftFileTime,
196 ret = GetLastError ();
197 ::Error (
"GetCPUTime",
" Error on GetProcessTimes 0x%lx", (
int)ret);
225 realt -= hours * 3600;
230 if (realt < 0) realt = 0;
231 if (cput < 0) cput = 0;
233 if (opt && *opt ==
'm') {
235 Printf(
"Real time %d:%02d:%06.3f, CP time %.3f, %d slices", hours, min, realt, cput,
Counter());
237 Printf(
"Real time %d:%02d:%06.3f, CP time %.3f", hours, min, realt, cput);
239 }
else if (opt && *opt ==
'u') {
241 Printf(
"Real time %d:%02d:%09.6f, CP time %.3f, %d slices", hours, min, realt, cput,
Counter());
243 Printf(
"Real time %d:%02d:%09.6f, CP time %.3f", hours, min, realt, cput);
247 Printf(
"Real time %d:%02d:%02d, CP time %.3f, %d slices", hours, min, sec, cput,
Counter());
249 Printf(
"Real time %d:%02d:%02d, CP time %.3f", hours, min, sec, cput);
void Printf(const char *fmt,...)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
static Double_t GetRealTime()
Private static method returning system realtime.
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
void Continue()
Resume a stopped stopwatch.
void Stop()
Stop the stopwatch.
void Print(Option_t *option="") const
Print the real and cpu time passed between the start and stop events.
TStopwatch()
Create a stopwatch and start it.
static Double_t GetCPUTime()
Private static method returning system CPU time.
The TTimeStamp encapsulates seconds and ns since EPOCH.