Working on heterogeneous platforms we need to use the system call gettimeofday. This function is portable and it measures ELAPSED time and CPU time in seconds and microseconds. Example: OSD_Timer aTimer; aTimer.Start(); // Start the timers (t1). ..... // Do something. aTimer.Stop(); // Stop the timers (t2). aTimer.Show(); // Give the elapsed time between t1 and t2. // Give also the process CPU time between // t1 and t2.
More...
|
| OSD_Timer (Standard_Boolean theThisThreadOnly=Standard_False) |
| Builds a Chronometer initialized and stopped.
|
|
void | Reset (const Standard_Real theTimeElapsedSec) |
| Stops and reinitializes the timer with specified elapsed time.
|
|
virtual void | Reset () override |
| Stops and reinitializes the timer with zero elapsed time.
|
|
virtual void | Restart () override |
| Restarts the Timer.
|
|
virtual void | Show () const override |
| Shows both the elapsed time and CPU time on the standard output stream <cout>.The chronometer can be running (Lap Time) or stopped.
|
|
virtual void | Show (Standard_OStream &os) const override |
| Shows both the elapsed time and CPU time on the output stream <OS>.
|
|
void | Show (Standard_Real &theSeconds, Standard_Integer &theMinutes, Standard_Integer &theHours, Standard_Real &theCPUtime) const |
| returns both the elapsed time(seconds,minutes,hours) and CPU time.
|
|
virtual void | Stop () override |
| Stops the Timer.
|
|
virtual void | Start () override |
| Starts (after Create or Reset) or restarts (after Stop) the Timer.
|
|
Standard_Real | ElapsedTime () const |
| Returns elapsed time in seconds.
|
|
| OSD_Chronometer (Standard_Boolean theThisThreadOnly=Standard_False) |
| Initializes a stopped Chronometer.
|
|
virtual | ~OSD_Chronometer () |
| Destructor.
|
|
Standard_Boolean | IsStarted () const |
| Return true if timer has been started.
|
|
Standard_Real | UserTimeCPU () const |
| Returns the current CPU user time in seconds. The chronometer can be running (laps Time) or stopped.
|
|
Standard_Real | SystemTimeCPU () const |
| Returns the current CPU system time in seconds. The chronometer can be running (laps Time) or stopped.
|
|
Standard_Boolean | IsThisThreadOnly () const |
| Return TRUE if current thread CPU time should be measured, and FALSE to measure all threads CPU time; FALSE by default,.
|
|
void | SetThisThreadOnly (Standard_Boolean theIsThreadOnly) |
| Set if current thread (TRUE) or all threads (FALSE) CPU time should be measured. Will raise exception if Timer is in started state.
|
|
void | Show (Standard_Real &theUserSeconds) const |
| Returns the current CPU user time in a variable. The chronometer can be running (laps Time) or stopped.
|
|
void | Show (Standard_Real &theUserSec, Standard_Real &theSystemSec) const |
| Returns the current CPU user and system time in variables. The chronometer can be running (laps Time) or stopped.
|
|
|
static Standard_Real | GetWallClockTime () |
| Returns current time in seconds with system-defined precision. The could be a system uptime or a time from some date. Returned value is intended for precise elapsed time measurements as a delta between timestamps. On Windows implemented via QueryPerformanceCounter(), on other systems via gettimeofday().
|
|
static void | GetProcessCPU (Standard_Real &UserSeconds, Standard_Real &SystemSeconds) |
| Returns CPU time (user and system) consumed by the current process since its start, in seconds. The actual precision of the measurement depends on granularity provided by the system, and is platform-specific.
|
|
static void | GetThreadCPU (Standard_Real &UserSeconds, Standard_Real &SystemSeconds) |
| Returns CPU time (user and system) consumed by the current thread since its start. Note that this measurement is platform-specific, as threads are implemented and managed differently on different platforms and CPUs.
|
|
Working on heterogeneous platforms we need to use the system call gettimeofday. This function is portable and it measures ELAPSED time and CPU time in seconds and microseconds. Example: OSD_Timer aTimer; aTimer.Start(); // Start the timers (t1). ..... // Do something. aTimer.Stop(); // Stop the timers (t2). aTimer.Show(); // Give the elapsed time between t1 and t2. // Give also the process CPU time between // t1 and t2.