ThreadUserTimer Class Reference

Measure CPU time spent executing instructions of this thread. More...

`#include <hrtimer.h>`

Inheritance diagram for ThreadUserTimer:

## Public Member Functions

| ThreadUserTimer (Unit unit=TimerBase::SECONDS, bool stuckAtZero=false)
| Construct a ThreadUserTimer.
TimerWord | GetCurrentTimerValue ()
| Retrieve the current timer value.
TimerWord | TicksPerSecond ()
| Retrieve ticks per second.
Public Member Functions inherited from TimerBase
| TimerBase (Unit unit, bool stuckAtZero)
| Construct a TimerBase.
void | StartTimer ()
| Start the timer.
double | ElapsedTimeAsDouble ()
| Retrieve the elapsed time.
unsigned long | ElapsedTime ()
| Retrieve the elapsed time.

## Additional Inherited Members

Public Types inherited from TimerBase
enum | Unit { SECONDS = 0 , MILLISECONDS , MICROSECONDS , NANOSECONDS }
| Unit of measure. More...

## Detailed Description

Measure CPU time spent executing instructions of this thread.

ThreadUserTimer requires support of the OS. On Unix-based it reports process time. On Windows NT or later desktops and servers it reports thread times with performance counter precision.. On Windows Phone and Windows Store it reports wall clock time with performance counter precision. On all others it reports wall clock time.

Note
  ThreadUserTimer only works correctly on Windows NT or later desktops and servers.

See also
  Timer

Definition at line 108 of file hrtimer.h.

## Constructor & Destructor Documentation

## ThreadUserTimer()

ThreadUserTimer::ThreadUserTimer | ( | Unit | unit = TimerBase::SECONDS,
|  | bool | stuckAtZero = false )

inline

Construct a ThreadUserTimer.

Parameters

  unit | the unit of measure
  stuckAtZero | flag

Definition at line 114 of file hrtimer.h.

## Member Function Documentation

## GetCurrentTimerValue()

TimerWord ThreadUserTimer::GetCurrentTimerValue | ( |  | ) |

virtual

Retrieve the current timer value.

Returns
  the current timer value

Implements TimerBase.

Definition at line 121 of file hrtimer.cpp.

## TicksPerSecond()

TimerWord ThreadUserTimer::TicksPerSecond | ( |  | ) |

virtual

Retrieve ticks per second.

Returns
  ticks per second

TicksPerSecond() is not the timer resolution. It is a conversion factor into seconds.

Implements TimerBase.

Definition at line 159 of file hrtimer.cpp.

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

- hrtimer.h
- hrtimer.cpp