glusterfs: update for new API
[fio.git] / debug.h
CommitLineData
a3d741fa
JA
1#ifndef FIO_DEBUG_H
2#define FIO_DEBUG_H
3
5ec3bc54 4#include "lib/types.h"
a3d741fa
JA
5
6enum {
7 FD_PROCESS = 0,
8 FD_FILE,
9 FD_IO,
10 FD_MEM,
11 FD_BLKTRACE,
12 FD_VERIFY,
13 FD_RANDOM,
14 FD_PARSE,
cd991b9e 15 FD_DISKUTIL,
5e1d306e 16 FD_JOB,
29adda3c 17 FD_MUTEX,
79d16311 18 FD_PROFILE,
c223da83 19 FD_TIME,
eb7976ef 20 FD_NET,
3e260a46 21 FD_RATE,
0c56718d 22 FD_COMPRESS,
16e56d25 23 FD_STEADYSTATE,
e569ca6b 24 FD_HELPERTHREAD,
4806b824 25 FD_ZBD,
a3d741fa
JA
26 FD_DEBUG_MAX,
27};
28
5ec3bc54
JA
29extern unsigned int fio_debug_jobno, *fio_debug_jobp, *fio_warned;
30
31static inline bool fio_did_warn(unsigned int mask)
32{
f2cd9160 33 if (*fio_warned & mask)
5ec3bc54 34 return true;
5ec3bc54 35
f2cd9160 36 *fio_warned |= mask;
5ec3bc54
JA
37 return false;
38}
69b98d4c 39
5bdc4522
JA
40enum {
41 FIO_WARN_ROOT_FLUSH = 1,
7fc08e99 42 FIO_WARN_VERIFY_BUF = 2,
264e3d30 43 FIO_WARN_ZONED_BUG = 4,
e2446166 44 FIO_WARN_IOLOG_DROP = 8,
825b0a75 45 FIO_WARN_FADVISE = 16,
19a8064e 46 FIO_WARN_BTRACE_ZERO = 32,
5bdc4522
JA
47};
48
a3d741fa
JA
49#ifdef FIO_INC_DEBUG
50struct debug_level {
51 const char *name;
0b8d11ed 52 const char *help;
a3d741fa 53 unsigned long shift;
5e1d306e 54 unsigned int jobno;
a3d741fa 55};
447931d9 56extern const struct debug_level debug_levels[];
a3d741fa
JA
57
58extern unsigned long fio_debug;
59
985ee30c 60void __dprint(int type, const char *str, ...) __attribute__((format (printf, 2, 3)));
bf84eacb
JA
61
62#define dprint(type, str, args...) \
63 do { \
0c7a0b6b 64 if (((1 << type) & fio_debug) == 0) \
bf84eacb
JA
65 break; \
66 __dprint((type), (str), ##args); \
67 } while (0) \
a3d741fa
JA
68
69#else
70
bf84eacb
JA
71static inline void dprint(int type, const char *str, ...)
72{
73}
a3d741fa
JA
74#endif
75
76#endif