Commit | Line | Data |
---|---|---|
a3d741fa JA |
1 | #ifndef FIO_DEBUG_H |
2 | #define FIO_DEBUG_H | |
3 | ||
4 | #include <assert.h> | |
5 | #include "log.h" | |
6 | ||
7 | enum { | |
8 | FD_PROCESS = 0, | |
9 | FD_FILE, | |
10 | FD_IO, | |
11 | FD_MEM, | |
12 | FD_BLKTRACE, | |
13 | FD_VERIFY, | |
14 | FD_RANDOM, | |
15 | FD_PARSE, | |
cd991b9e | 16 | FD_DISKUTIL, |
a3d741fa JA |
17 | FD_DEBUG_MAX, |
18 | }; | |
19 | ||
20 | #ifdef FIO_INC_DEBUG | |
21 | struct debug_level { | |
22 | const char *name; | |
23 | unsigned long shift; | |
24 | }; | |
25 | extern struct debug_level debug_levels[]; | |
26 | ||
27 | extern unsigned long fio_debug; | |
28 | ||
29 | #define dprint(type, str, args...) \ | |
30 | do { \ | |
31 | assert(type < FD_DEBUG_MAX); \ | |
32 | if ((((1 << type)) & fio_debug) == 0) \ | |
33 | break; \ | |
34 | log_info("%-8s ", debug_levels[(type)].name); \ | |
35 | log_info(str, ##args); \ | |
36 | } while (0) | |
37 | ||
38 | #else | |
39 | ||
40 | #define dprint(type, str, args...) | |
41 | #endif | |
42 | ||
43 | #endif |