PixelLightAPI  .
Public Member Functions
PLCore::Stopwatch Class Reference

Stopwatch. More...

#include <Stopwatch.h>

List of all members.

Public Member Functions

 Stopwatch ()
 Default constructor.
 Stopwatch (bool bStartAtOnce)
 Constructor.
 ~Stopwatch ()
 Destructor.
PLCORE_API void Start ()
 Starts the stopwatch.
PLCORE_API uint64 Stop ()
 Stops the stopwatch.
float GetWeeks () const
 Returns the number of weeks since the stopwatch was started.
float GetDays () const
 Returns the number of days since the stopwatch was started.
float GetHours () const
 Returns the number of hours since the stopwatch was started.
float GetMinutes () const
 Returns the number of minutes since the stopwatch was started.
float GetSeconds () const
 Returns the number of seconds since the stopwatch was started.
float GetMilliseconds () const
 Returns the number of milliseconds since the stopwatch was started.
PLCORE_API uint64 GetMicroseconds () const
 Retrieves the number of microseconds since the stopwatch was started.

Detailed Description

Stopwatch.

*    Usage example:
*
*    // Start the stopwatch
*    Stopwatch cStopwatch(true);
*
*    // Do some stuff
*
*    // Measure elapsed time
*    float fElapsedSeconds = cStopwatch.GetSeconds();
*  
Note:
  • The stopwatch implementation is just using "System::GetInstance()->GetMicroseconds()" and is therefore quite lightweight

Constructor & Destructor Documentation

Default constructor.

Constructor.

PLCore::Stopwatch::Stopwatch ( bool  bStartAtOnce) [inline]

Constructor.

Parameters:
[in]bStartAtOnceIf this parameter is 'true', the stopwatch is started automatically at once

Destructor.


Member Function Documentation

PLCORE_API void PLCore::Stopwatch::Start ( )

Starts the stopwatch.

Note:
  • If the stopwatch is already running it's restarted
PLCORE_API uint64 PLCore::Stopwatch::Stop ( )

Stops the stopwatch.

Returns:
The elapsed time in microseconds since Start()
Note:
  • Often it's adequate to just request the past time using e.g. "GetMilliseconds()" and not explicitly stopping the stopwatch
float PLCore::Stopwatch::GetWeeks ( ) const [inline]

Returns the number of weeks since the stopwatch was started.

Returns:
Number of weeks elapsed since the stopwatch was started
float PLCore::Stopwatch::GetDays ( ) const [inline]

Returns the number of days since the stopwatch was started.

Returns:
Number of days elapsed since the stopwatch was started
float PLCore::Stopwatch::GetHours ( ) const [inline]

Returns the number of hours since the stopwatch was started.

Returns:
Number of hours elapsed since the stopwatch was started
float PLCore::Stopwatch::GetMinutes ( ) const [inline]

Returns the number of minutes since the stopwatch was started.

Returns:
Number of minutes elapsed since the stopwatch was started
float PLCore::Stopwatch::GetSeconds ( ) const [inline]

Returns the number of seconds since the stopwatch was started.

Returns:
Number of seconds elapsed since the stopwatch was started
float PLCore::Stopwatch::GetMilliseconds ( ) const [inline]

Returns the number of milliseconds since the stopwatch was started.

Returns:
Number of milliseconds elapsed since the stopwatch was started
PLCORE_API uint64 PLCore::Stopwatch::GetMicroseconds ( ) const

Retrieves the number of microseconds since the stopwatch was started.

Returns:
Number of microseconds elapsed since the stopwatch was started

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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:16
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported