forked from QwazyWabbitWOS/W-O-R-Rampage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperformance.h
37 lines (33 loc) · 1.11 KB
/
performance.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
// **********************************************
// Windows high performance counter
// **********************************************
/* How to use these macros:
* Use only one instance at a time. This uses
* a single global variable for the start time.
*
* Put START_PERFORMANCE_TIMER at the point in the
* function you want to start timing.
*
* Put STOP_PERFORMANCE_TIMER at the end of the timed
* section. Semi-colons are not needed.
*
* Read the execution times in the debugger's Output
* window in VS or in WinDbg attached to the process.
* On Linux the timing is output to the server console.
* If you prefer output to server console on Windows
* alter the _STOP_PERFORMANCE_TIMER function to use
* Com_Printf or gi.dprintf as needed.
*/
#ifdef _WIN32
#ifdef _DEBUG
void _STOP_PERFORMANCE_TIMER (char* str);
void _START_PERFORMANCE_TIMER (void);
#define START_PERFORMANCE_TIMER _START_PERFORMANCE_TIMER();
#define STOP_PERFORMANCE_TIMER _STOP_PERFORMANCE_TIMER(__func__);
#else
#define START_PERFORMANCE_TIMER
#define STOP_PERFORMANCE_TIMER
#endif
#endif
void DbgPrintf (char *msg, ...);