ERC CISST - cisst software

osaStopwatch Class Reference

#include <osaStopwatch.h>

Collaboration diagram for osaStopwatch:

Collaboration graph
[legend]
List of all members.

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.

Definition at line 80 of file osaStopwatch.h.

Public Types

Public Member Functions


Member Function Documentation

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

Referenced by Start().

void osaStopwatch::Reset ( void   )  [inline]

Reset all the counters to zero, and stop the watch

Definition at line 112 of file osaStopwatch.h.

Referenced by osaStopwatch().

void osaStopwatch::Start ( void   )  [inline]

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

Definition at line 129 of file osaStopwatch.h.

References CMN_LOG_INIT_ERROR, GetTimeGranularity(), and IsRunning().

void osaStopwatch::Stop ( void   )  [inline]

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

Definition at line 156 of file osaStopwatch.h.

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

Definition at line 168 of file osaStopwatch.h.

Referenced by GetCurrentRead(), GetElapsedTime(), Start(), and Stop().

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.

Definition at line 178 of file osaStopwatch.h.

References IsRunning().

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.

Definition at line 189 of file osaStopwatch.h.

References IsRunning().


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu