# Ogre::Timer Class Reference

Timer class. More...

`#include <OgreTimerImp.h>`

List of all members.

## Public Member Functions

| Timer ()
| ~Timer ()
bool | setOption (const String &strKey, const void *pValue)
| Method for setting a specific option of the Timer.
void | reset ()
| Resets timer.
unsigned long | getMilliseconds ()
| Returns milliseconds since initialisation or last reset.
unsigned long | getMicroseconds ()
| Returns microseconds since initialisation or last reset.
unsigned long | getMillisecondsCPU ()
| Returns milliseconds since initialisation or last reset, only CPU time measured.
unsigned long | getMicrosecondsCPU ()
| Returns microseconds since initialisation or last reset, only CPU time measured.
| Timer ()
| ~Timer ()
bool | setOption (const String &strKey, const void *pValue)
| Method for setting a specific option of the Timer.
void | reset ()
| Resets timer.
unsigned long | getMilliseconds ()
| Returns milliseconds since initialisation or last reset.
unsigned long | getMicroseconds ()
| Returns microseconds since initialisation or last reset.
unsigned long | getMillisecondsCPU ()
| Returns milliseconds since initialisation or last reset, only CPU time measured.
unsigned long | getMicrosecondsCPU ()
| Returns microseconds since initialisation or last reset, only CPU time measured.
| Timer ()
| Timer constructor.
| ~Timer ()
bool | setOption (const String &strKey, const void *pValue)
| Method for setting a specific option of the Timer.
void | reset ()
| Resets timer.
unsigned long | getMilliseconds ()
| Returns milliseconds since initialisation or last reset.
unsigned long | getMicroseconds ()
| Returns microseconds since initialisation or last reset.
unsigned long | getMillisecondsCPU ()
| Returns milliseconds since initialisation or last reset, only CPU time measured.
unsigned long | getMicrosecondsCPU ()
| Returns microseconds since initialisation or last reset, only CPU time measured.

## Private Attributes

struct timeval | start
clock_t | zeroClock
clock_t | mZeroClock
DWORD | mStartTick
LONGLONG | mLastTime
LARGE_INTEGER | mStartTime
LARGE_INTEGER | mFrequency
DWORD | mTimerMask

## Detailed Description

Timer class.

Definition at line 38 of file GLX/OgreTimerImp.h.

## Constructor & Destructor Documentation

Ogre::Timer::Timer | ( |  | ) |

Ogre::Timer::~Timer | ( |  | ) |

Ogre::Timer::Timer | ( |  | ) |

Ogre::Timer::~Timer | ( |  | ) |

Ogre::Timer::Timer | ( |  | ) |

Timer constructor.

MUST be called on same thread that calls getMilliseconds()

Ogre::Timer::~Timer | ( |  | ) |

## Member Function Documentation

bool Ogre::Timer::setOption | ( | const String & | strKey,
|  | const void * | pValue |
| ) |  |  |

Method for setting a specific option of the Timer.

These options are usually specific for a certain implementation of the Timer class, and may (and probably will) not exist across different implementations. reset() must be called after all setOption() calls.

Parameters:

  | strKey | The name of the option to set
  | pValue | A pointer to the value - the size should be calculated by the timer based on the key

Returns:
  On success, true is returned.

  On failure, false is returned.

Definition at line 61 of file GLX/OgreTimerImp.h.

void Ogre::Timer::reset | ( |  | ) |

Resets timer.

unsigned long Ogre::Timer::getMilliseconds | ( |  | ) |

Returns milliseconds since initialisation or last reset.

unsigned long Ogre::Timer::getMicroseconds | ( |  | ) |

Returns microseconds since initialisation or last reset.

unsigned long Ogre::Timer::getMillisecondsCPU | ( |  | ) |

Returns milliseconds since initialisation or last reset, only CPU time measured.

unsigned long Ogre::Timer::getMicrosecondsCPU | ( |  | ) |

Returns microseconds since initialisation or last reset, only CPU time measured.

bool Ogre::Timer::setOption | ( | const String & | strKey,
|  | const void * | pValue |
| ) |  |  |

Method for setting a specific option of the Timer.

These options are usually specific for a certain implementation of the Timer class, and may (and probably will) not exist across different implementations. reset() must be called after all setOption() calls.

Parameters:

  | strKey | The name of the option to set
  | pValue | A pointer to the value - the size should be calculated by the timer based on the key

Returns:
  On success, true is returned.

  On failure, false is returned.

Definition at line 61 of file OSX/OgreTimerImp.h.

void Ogre::Timer::reset | ( |  | ) |

Resets timer.

unsigned long Ogre::Timer::getMilliseconds | ( |  | ) |

Returns milliseconds since initialisation or last reset.

unsigned long Ogre::Timer::getMicroseconds | ( |  | ) |

Returns microseconds since initialisation or last reset.

unsigned long Ogre::Timer::getMillisecondsCPU | ( |  | ) |

Returns milliseconds since initialisation or last reset, only CPU time measured.

unsigned long Ogre::Timer::getMicrosecondsCPU | ( |  | ) |

Returns microseconds since initialisation or last reset, only CPU time measured.

bool Ogre::Timer::setOption | ( | const String & | strKey,
|  | const void * | pValue |
| ) |  |  |

Method for setting a specific option of the Timer.

These options are usually specific for a certain implementation of the Timer class, and may (and probably will) not exist across different implementations. reset() must be called after all setOption() calls.

  Current options supported are:
  - "QueryAffinityMask" (DWORD): Set the thread affinity mask to be used to check the timer. If 'reset' has been called already this mask should overlap with the process mask that was in force at that point, and should be a power of two (a single core).

Parameters:

  | strKey | The name of the option to set
  | pValue | A pointer to the value - the size should be calculated by the timer based on the key

Returns:
  On success, true is returned.

  On failure, false is returned.

void Ogre::Timer::reset | ( |  | ) |

Resets timer.

unsigned long Ogre::Timer::getMilliseconds | ( |  | ) |

Returns milliseconds since initialisation or last reset.

unsigned long Ogre::Timer::getMicroseconds | ( |  | ) |

Returns microseconds since initialisation or last reset.

unsigned long Ogre::Timer::getMillisecondsCPU | ( |  | ) |

Returns milliseconds since initialisation or last reset, only CPU time measured.

unsigned long Ogre::Timer::getMicrosecondsCPU | ( |  | ) |

Returns microseconds since initialisation or last reset, only CPU time measured.

## Member Data Documentation

struct timeval Ogre::Timer::start`[read, private]`

Definition at line 41 of file GLX/OgreTimerImp.h.

clock_t Ogre::Timer::zeroClock`[private]`

Definition at line 42 of file GLX/OgreTimerImp.h.

clock_t Ogre::Timer::mZeroClock`[private]`

Definition at line 50 of file WIN32/OgreTimerImp.h.

DWORD Ogre::Timer::mStartTick`[private]`

Definition at line 52 of file WIN32/OgreTimerImp.h.

LONGLONG Ogre::Timer::mLastTime`[private]`

Definition at line 53 of file WIN32/OgreTimerImp.h.

LARGE_INTEGER Ogre::Timer::mStartTime`[private]`

Definition at line 54 of file WIN32/OgreTimerImp.h.

LARGE_INTEGER Ogre::Timer::mFrequency`[private]`

Definition at line 55 of file WIN32/OgreTimerImp.h.

DWORD Ogre::Timer::mTimerMask`[private]`

Definition at line 57 of file WIN32/OgreTimerImp.h.

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

- GLX/OgreTimerImp.h
- OSX/OgreTimerImp.h
- WIN32/OgreTimerImp.h

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat May 10 16:25:13 2008