-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.h
50 lines (40 loc) · 1014 Bytes
/
debug.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
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef DEBUG_INCLUDED
#define DEBUG_INCLUDED
#include "config.h"
#include "state.h"
void startDebugging();
void stopDebugging();
void isDebugging();
/**
* Print current instruction for debugging.
*/
void debug(GbState *s, string message);
#ifdef IS_PROFILING
#include <stdio.h>
#define UPDATE_PROFILE(id) updateProfile(id);
#define INIT_PROFILE resetProfile();
#define DISPLAY_PROFILE displayProfile();
typedef struct {
int id;
long sum;
long count;
} ProfileEntry;
/**
* Update profile data for a given profile section.
* @param id Identifies the profile section.
*/
void updateProfile(int id);
/**
* Reset all profile information back to 0 to start a new profiling session.
*/
void resetProfile();
/**
* Prints out all available profile data.
*/
void displayProfile();
#else
#define UPDATE_PROFILE(id)
#define INIT_PROFILE
#define DISPLAY_PROFILE
#endif
#endif