OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    OSD_Chronometer Class Reference

    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>

    Inheritance diagram for OSD_Chronometer:

    Public Member Functions

     OSD_Chronometer (bool theThisThreadOnly=false)
     Initializes a stopped Chronometer.
    virtual ~OSD_Chronometer ()
     Destructor.
    bool 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.
    double UserTimeCPU () const
     Returns the current CPU user time in seconds. The chronometer can be running (laps Time) or stopped.
    double SystemTimeCPU () const
     Returns the current CPU system time in seconds. The chronometer can be running (laps Time) or stopped.
    bool 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 (bool 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 (double &theUserSeconds) const
     Returns the current CPU user time in a variable. The chronometer can be running (laps Time) or stopped.
    void Show (double &theUserSec, double &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 (double &UserSeconds, double &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 (double &UserSeconds, double &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

    double myStartCpuUser
    double myStartCpuSys
    double myCumulCpuUser
    double myCumulCpuSys
    bool myIsStopped
    bool myIsThreadOnly

    Detailed Description

    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.

    Constructor & Destructor Documentation

    ◆ OSD_Chronometer()

    OSD_Chronometer::OSD_Chronometer ( bool theThisThreadOnly = 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.

    ◆ ~OSD_Chronometer()

    virtual OSD_Chronometer::~OSD_Chronometer ( )
    virtual

    Destructor.

    Member Function Documentation

    ◆ GetProcessCPU()

    void OSD_Chronometer::GetProcessCPU ( double & UserSeconds,
    double & SystemSeconds )
    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.

    ◆ GetThreadCPU()

    void OSD_Chronometer::GetThreadCPU ( double & UserSeconds,
    double & SystemSeconds )
    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.

    ◆ IsStarted()

    bool OSD_Chronometer::IsStarted ( ) const
    inline

    Return true if timer has been started.

    ◆ IsThisThreadOnly()

    bool OSD_Chronometer::IsThisThreadOnly ( ) const
    inline

    Return TRUE if current thread CPU time should be measured, and FALSE to measure all threads CPU time; FALSE by default,.

    ◆ Reset()

    virtual void OSD_Chronometer::Reset ( )
    virtual

    Stops and Reinitializes the Chronometer.

    Reimplemented in OSD_Timer.

    ◆ Restart()

    virtual void OSD_Chronometer::Restart ( )
    virtual

    Restarts the Chronometer.

    Reimplemented in OSD_Timer.

    ◆ SetThisThreadOnly()

    void OSD_Chronometer::SetThisThreadOnly ( bool theIsThreadOnly)

    Set if current thread (TRUE) or all threads (FALSE) CPU time should be measured. Will raise exception if Timer is in started state.

    ◆ Show() [1/4]

    virtual void OSD_Chronometer::Show ( ) const
    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.

    ◆ Show() [2/4]

    void OSD_Chronometer::Show ( double & theUserSec,
    double & theSystemSec ) const

    Returns the current CPU user and system time in variables. The chronometer can be running (laps Time) or stopped.

    ◆ Show() [3/4]

    void OSD_Chronometer::Show ( double & theUserSeconds) const
    inline

    Returns the current CPU user time in a variable. The chronometer can be running (laps Time) or stopped.

    ◆ Show() [4/4]

    virtual void OSD_Chronometer::Show ( Standard_OStream & theOStream) const
    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.

    ◆ Start()

    virtual void OSD_Chronometer::Start ( )
    virtual

    Starts (after Create or Reset) or restarts (after Stop) the chronometer.

    Reimplemented in OSD_Timer.

    ◆ Stop()

    virtual void OSD_Chronometer::Stop ( )
    virtual

    Stops the Chronometer.

    Reimplemented in OSD_Timer.

    ◆ SystemTimeCPU()

    double OSD_Chronometer::SystemTimeCPU ( ) const
    inline

    Returns the current CPU system time in seconds. The chronometer can be running (laps Time) or stopped.

    ◆ UserTimeCPU()

    double OSD_Chronometer::UserTimeCPU ( ) const
    inline

    Returns the current CPU user time in seconds. The chronometer can be running (laps Time) or stopped.

    Field Documentation

    ◆ myCumulCpuSys

    double OSD_Chronometer::myCumulCpuSys
    protected

    ◆ myCumulCpuUser

    double OSD_Chronometer::myCumulCpuUser
    protected

    ◆ myIsStopped

    bool OSD_Chronometer::myIsStopped
    protected

    ◆ myIsThreadOnly

    bool OSD_Chronometer::myIsThreadOnly
    protected

    ◆ myStartCpuSys

    double OSD_Chronometer::myStartCpuSys
    protected

    ◆ myStartCpuUser

    double OSD_Chronometer::myStartCpuUser
    protected

    The documentation for this class was generated from the following file: