Performance.h
Go to the documentation of this file.
1 #ifndef MiscLib__PERFORMANCE_HEADER__
2 #define MiscLib__PERFORMANCE_HEADER__
3 #ifdef WIN32
4 #include <windows.h>
5 #undef max
6 #undef min
7 #endif
8 
9 namespace MiscLib
10 {
11 #ifdef WIN32
12  typedef __int64 performance_t;
14  {
15  LARGE_INTEGER count;
16  QueryPerformanceCounter(&count);
17  return count.QuadPart;
18  }
19  inline double GetPerformanceFreq()
20  {
21  LARGE_INTEGER dummy_performance_freq;
22  QueryPerformanceFrequency(&dummy_performance_freq);
23  performance_t performance_freq = dummy_performance_freq.QuadPart;
24  return double(performance_freq);
25  }
26 #else
27  typedef clock_t performance_t;
29  {
30  return clock();
31  }
32  inline double GetPerformanceFreq()
33  {
34  return double(CLOCKS_PER_SEC);
35  }
36 #endif
37 };
38 
39 #endif
MiscLib::GetPerformanceCounter
performance_t GetPerformanceCounter()
Definition: Performance.h:28
MiscLib::GetPerformanceFreq
double GetPerformanceFreq()
Definition: Performance.h:32
MiscLib::performance_t
clock_t performance_t
Definition: Performance.h:27
MiscLib
Definition: AlignedAllocator.h:11