Open CASCADE Technology  6.9.0
Public Member Functions

OSD_Timer Class Reference

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...

#include <OSD_Timer.hxx>

Inheritance diagram for OSD_Timer:
Inheritance graph
[legend]

Public Member Functions

 OSD_Timer ()
 Builds a Chronometer initialized and stopped. More...
 
virtual void Reset ()
 Stops and reinitializes the timer. More...
 
virtual void Show () const
 Shows both the elapsed time and CPU time on the standard output stream <cout>.The chronometer can be running (Lap Time) or stopped. More...
 
virtual void Show (Standard_OStream &os) const
 Shows both the elapsed time and CPU time on the output stream <OS>. More...
 
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. More...
 
virtual void Stop ()
 Stops the Timer. More...
 
virtual void Start ()
 Starts (after Create or Reset) or restarts (after Stop) the Timer. More...
 
Standard_Real ElapsedTime () const
 Returns elapsed time in seconds. More...
 
- Public Member Functions inherited from OSD_Chronometer
 OSD_Chronometer (const Standard_Boolean ThisThreadOnly=Standard_False)
 Initializes a stopped Chronometer. More...
 
virtual ~OSD_Chronometer ()
 
void Show (Standard_Real &theUserSeconds) const
 Returns the current CPU user time in a variable. The chronometer can be running (laps Time) or stopped. More...
 
void Show (Standard_Real &theUserSeconds, Standard_Real &theSystemSeconds) const
 Returns the current CPU user and system time in variables. The chronometer can be running (laps Time) or stopped. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OSD_Chronometer
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. More...
 
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. More...
 
- Protected Attributes inherited from OSD_Chronometer
Standard_Boolean Stopped
 

Detailed Description

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.

Constructor & Destructor Documentation

OSD_Timer::OSD_Timer ( )

Builds a Chronometer initialized and stopped.

Member Function Documentation

Standard_Real OSD_Timer::ElapsedTime ( ) const

Returns elapsed time in seconds.

virtual void OSD_Timer::Reset ( )
virtual

Stops and reinitializes the timer.

Reimplemented from OSD_Chronometer.

virtual void OSD_Timer::Show ( ) const
virtual

Shows both the elapsed time and CPU time on the standard output stream <cout>.The chronometer can be running (Lap Time) or stopped.

Reimplemented from OSD_Chronometer.

virtual void OSD_Timer::Show ( Standard_OStream os) const
virtual

Shows both the elapsed time and CPU time on the output stream <OS>.

Reimplemented from OSD_Chronometer.

void OSD_Timer::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 OSD_Timer::Start ( )
virtual

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

Reimplemented from OSD_Chronometer.

virtual void OSD_Timer::Stop ( )
virtual

Stops the Timer.

Reimplemented from OSD_Chronometer.


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