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, |
5e1d306e | 17 | FD_JOB, |
29adda3c | 18 | FD_MUTEX, |
79d16311 | 19 | FD_PROFILE, |
c223da83 | 20 | FD_TIME, |
eb7976ef | 21 | FD_NET, |
3e260a46 | 22 | FD_RATE, |
0c56718d | 23 | FD_COMPRESS, |
a3d741fa JA |
24 | FD_DEBUG_MAX, |
25 | }; | |
26 | ||
69b98d4c JA |
27 | extern unsigned int fio_debug_jobno, *fio_debug_jobp; |
28 | ||
a3d741fa JA |
29 | #ifdef FIO_INC_DEBUG |
30 | struct debug_level { | |
31 | const char *name; | |
0b8d11ed | 32 | const char *help; |
a3d741fa | 33 | unsigned long shift; |
5e1d306e | 34 | unsigned int jobno; |
a3d741fa JA |
35 | }; |
36 | extern struct debug_level debug_levels[]; | |
37 | ||
38 | extern unsigned long fio_debug; | |
39 | ||
985ee30c | 40 | void __dprint(int type, const char *str, ...) __attribute__((format (printf, 2, 3))); |
bf84eacb JA |
41 | |
42 | #define dprint(type, str, args...) \ | |
43 | do { \ | |
44 | if ((((1 << type)) & fio_debug) == 0) \ | |
45 | break; \ | |
46 | __dprint((type), (str), ##args); \ | |
47 | } while (0) \ | |
a3d741fa JA |
48 | |
49 | #else | |
50 | ||
bf84eacb JA |
51 | static inline void dprint(int type, const char *str, ...) |
52 | { | |
53 | } | |
a3d741fa JA |
54 | #endif |
55 | ||
56 | #endif |