You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lunarium_OLD/src/utils/HighResTimer.h

60 lines
1.3 KiB
C

/******************************************************************************
* Filename: HighResTimer.h
* Date: 12/06/2010
* Mod. Date: 03/21/2018
* Author: Joseph R. Pollack
* Purpose: A high resolution timer suitable for profiling code. This new
* version has stripped out the game specific functionality and
* does not include windows.h in the header.
******************************************************************************/
#ifndef HIGH_RES_TIMER_H_
#define HIGH_RES_TIMER_H_
#include <stdint.h>
namespace Lunarium
{
class HighResTimer
{
public:
// NOTE: Currently unused
enum eUnits { SECONDS, MILLISECONDS, MICROSECONDS, NANOSECONDS, PICOSECONDS };
public:
HighResTimer();
void Initialize();
// Starts or re starts the timer.
void Reset();
// Returns the amount of time in microseconds since the last Reset() call.
int64_t GetElapsedTime();
// Returns the elapsed time in terms of seconds
double GetElapsedSeconds();
private:
int64_t mStartTime;
int64_t mTickFrequency;
const int mcMils = 1000000;
const int mcBils = 1000000000;
const long long mcTrils = 1000000000000;
/* // OLD MEMBERS
long long m_TickFreqQuadPart;
double m_StartTime;
*/
};
}
#endif // HIGH_RES_TIMER_H_