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
9namespace MiscLib
10{
11#ifdef WIN32
12 typedef __int64 performance_t;
13
14 inline performance_t
16 {
17 LARGE_INTEGER count;
18 QueryPerformanceCounter(&count);
19 return count.QuadPart;
20 }
21
22 inline double
24 {
25 LARGE_INTEGER dummy_performance_freq;
26 QueryPerformanceFrequency(&dummy_performance_freq);
27 performance_t performance_freq = dummy_performance_freq.QuadPart;
28 return double(performance_freq);
29 }
30#else
31 typedef clock_t performance_t;
32
33 inline performance_t
35 {
36 return clock();
37 }
38
39 inline double
41 {
42 return double(CLOCKS_PER_SEC);
43 }
44#endif
45}; // namespace MiscLib
46
47#endif
performance_t GetPerformanceCounter()
Definition Performance.h:34
clock_t performance_t
Definition Performance.h:31
double GetPerformanceFreq()
Definition Performance.h:40