aboutsummaryrefslogtreecommitdiff
path: root/c/debug.h
blob: e9cefa3a0c0783d5edcc908dfe307bef4032af14 (plain)
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
#ifndef DEBUG_H
#define DEBUG_H

#include <windows.h>

/* Benchmark objects measure and print the time in microseconds
 * between construction and destruction. Given a unique id, they also
 * calculate a running average of the last `avgmax' instances of
 * objects of the same id. */
struct Benchmark
{
	Benchmark(const char* name, int id, int avgmax);
	~Benchmark();

	/* Don't print time on destruction. */
	void Disable();

	long long ticks;
	bool disabled = false;
	int id;
	int avgmax;
	const char* name;
};

/* Return name of given window message (WM_*). */
const char* WmName(UINT uMsg);

#endif