cisst-saw
Loading...
Searching...
No Matches
osaStopwatch Class Reference

#include <osaStopwatch.h>

Public Types

typedef unsigned long MillisecondsCounter
typedef double SecondsCounter

Public Member Functions

 osaStopwatch (void)
double CISST_EXPORT GetTimeGranularity (void) const
void Reset (void)
void Start (void)
void Stop (void)
bool IsRunning (void) const
MillisecondsCounter CISST_DEPRECATED GetCurrentRead (void) const
SecondsCounter GetElapsedTime (void) const

Detailed Description

Implement a simple stopwatch mechanism, which is helpful in profiling, debugging, and performance estimation.

The osaStopwatch class uses system calls to obtain time at the finest granularity available in the system. Note that a system call may sometimes invoke a context switch, and use them only when needed to interfere the least with the normal performance of the program.

To reduce overhead (for more efficient time polling), all the methods are inlined.

Member Typedef Documentation

◆ MillisecondsCounter

typedef unsigned long osaStopwatch::MillisecondsCounter

◆ SecondsCounter

Constructor & Destructor Documentation

◆ osaStopwatch()

osaStopwatch::osaStopwatch ( void )
inline

Member Function Documentation

◆ GetCurrentRead()

MillisecondsCounter CISST_DEPRECATED osaStopwatch::GetCurrentRead ( void ) const
inline

Return the current read of the stopwatch without changing the running state. This method is now deprecated as it returns a time interval in milliseconds (integer). Use GetElapsedTime() instead.

◆ GetElapsedTime()

SecondsCounter osaStopwatch::GetElapsedTime ( void ) const
inline

Return the current read of the stopwatch without changing the running state. Return a time interval in seconds using a "double" precision floating point number.

◆ GetTimeGranularity()

double CISST_EXPORT osaStopwatch::GetTimeGranularity ( void ) const

Return the granularity of time in the system, in seconds. The fraction part is the fraction of second that the system time granularity supports

◆ IsRunning()

bool osaStopwatch::IsRunning ( void ) const
inline

Returns true if the stopwatch is running and counting continues (i.e., if Start was called last). Returns false if the watch is stopped, i.e., if Stop or Reset was called last.

◆ Reset()

void osaStopwatch::Reset ( void )
inline

Reset all the counters to zero, and stop the watch

◆ Start()

void osaStopwatch::Start ( void )
inline

Start the stopwatch from its current counter state. If the watch is already running, do nothing

◆ Stop()

void osaStopwatch::Stop ( void )
inline

Stop the stopwatch so that its counter state is kept until a Start or a Reset


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