Add locking around reads of td->io_blocks and io_byes.
[fio.git] / debug.h
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,
16         FD_DISKUTIL,
17         FD_JOB,
18         FD_MUTEX,
19         FD_PROFILE,
20         FD_TIME,
21         FD_NET,
22         FD_RATE,
23         FD_COMPRESS,
24         FD_STEADYSTATE,
25         FD_DEBUG_MAX,
26 };
27
28 extern unsigned int fio_debug_jobno, *fio_debug_jobp;
29
30 #ifdef FIO_INC_DEBUG
31 struct debug_level {
32         const char *name;
33         const char *help;
34         unsigned long shift;
35         unsigned int jobno;
36 };
37 extern struct debug_level debug_levels[];
38
39 extern unsigned long fio_debug;
40
41 void __dprint(int type, const char *str, ...) __attribute__((format (printf, 2, 3)));
42
43 #define dprint(type, str, args...)                      \
44         do {                                            \
45                 if ((((1 << type)) & fio_debug) == 0)   \
46                         break;                          \
47                 __dprint((type), (str), ##args);        \
48         } while (0)                                     \
49
50 #else
51
52 static inline void dprint(int type, const char *str, ...)
53 {
54 }
55 #endif
56
57 #endif