Open CASCADE Technology 7.8.0
|
This class measures CPU time (both user and system) consumed by current process or thread. The chronometer can be started and stopped multiple times, and measures cumulative time. More...
#include <OSD_Chronometer.hxx>
Public Member Functions | |
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. | |
virtual void | Reset () |
Stops and Reinitializes the Chronometer. | |
virtual void | Restart () |
Restarts the Chronometer. | |
virtual void | Stop () |
Stops the Chronometer. | |
virtual void | Start () |
Starts (after Create or Reset) or restarts (after Stop) the chronometer. | |
virtual void | Show () const |
Shows the current CPU user and system time on the standard output stream <cout>. The chronometer can be running (laps Time) or stopped. | |
virtual void | Show (Standard_OStream &theOStream) const |
Shows the current CPU user and system time on the output stream <os>. The chronometer can be running (laps Time) or stopped. | |
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 Public Member Functions | |
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. | |
Protected Attributes | |
Standard_Real | myStartCpuUser |
Standard_Real | myStartCpuSys |
Standard_Real | myCumulCpuUser |
Standard_Real | myCumulCpuSys |
Standard_Boolean | myIsStopped |
Standard_Boolean | myIsThreadOnly |
This class measures CPU time (both user and system) consumed by current process or thread. The chronometer can be started and stopped multiple times, and measures cumulative time.
If only the thread is measured, calls to Stop() and Show() must occur from the same thread where Start() was called (unless chronometer is stopped); otherwise measurement will yield false values.
OSD_Chronometer::OSD_Chronometer | ( | Standard_Boolean | theThisThreadOnly = Standard_False | ) |
Initializes a stopped Chronometer.
If ThisThreadOnly is True, measured CPU time will account time of the current thread only; otherwise CPU of the process (all threads, and completed children) is measured.
|
virtual |
Destructor.
|
static |
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 |
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.
|
inline |
Return true if timer has been started.
|
inline |
Return TRUE if current thread CPU time should be measured, and FALSE to measure all threads CPU time; FALSE by default,.
|
virtual |
Stops and Reinitializes the Chronometer.
Reimplemented in OSD_Timer.
|
virtual |
Restarts the Chronometer.
Reimplemented in OSD_Timer.
void OSD_Chronometer::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.
|
virtual |
Shows the current CPU user and system time on the standard output stream <cout>. The chronometer can be running (laps Time) or stopped.
Reimplemented in OSD_Timer.
|
virtual |
Shows the current CPU user and system time on the output stream <os>. The chronometer can be running (laps Time) or stopped.
Reimplemented in OSD_Timer.
void OSD_Chronometer::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.
|
inline |
Returns the current CPU user time in a variable. The chronometer can be running (laps Time) or stopped.
|
virtual |
Starts (after Create or Reset) or restarts (after Stop) the chronometer.
Reimplemented in OSD_Timer.
|
inline |
Returns the current CPU system time in seconds. The chronometer can be running (laps Time) or stopped.
|
inline |
Returns the current CPU user time in seconds. The chronometer can be running (laps Time) or stopped.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |