filesetup: convert root flush warning to fio_did_warn()
[fio.git] / debug.h
... / ...
CommitLineData
1#ifndef FIO_DEBUG_H
2#define FIO_DEBUG_H
3
4#include <assert.h>
5#include "lib/types.h"
6#include "log.h"
7
8enum {
9 FD_PROCESS = 0,
10 FD_FILE,
11 FD_IO,
12 FD_MEM,
13 FD_BLKTRACE,
14 FD_VERIFY,
15 FD_RANDOM,
16 FD_PARSE,
17 FD_DISKUTIL,
18 FD_JOB,
19 FD_MUTEX,
20 FD_PROFILE,
21 FD_TIME,
22 FD_NET,
23 FD_RATE,
24 FD_COMPRESS,
25 FD_STEADYSTATE,
26 FD_HELPERTHREAD,
27 FD_DEBUG_MAX,
28};
29
30extern unsigned int fio_debug_jobno, *fio_debug_jobp, *fio_warned;
31
32static inline bool fio_did_warn(unsigned int mask)
33{
34 if (!(*fio_warned & mask)) {
35 *fio_warned |= mask;
36 return true;
37 }
38
39 return false;
40}
41
42enum {
43 FIO_WARN_ROOT_FLUSH = 1,
44};
45
46#ifdef FIO_INC_DEBUG
47struct debug_level {
48 const char *name;
49 const char *help;
50 unsigned long shift;
51 unsigned int jobno;
52};
53extern struct debug_level debug_levels[];
54
55extern unsigned long fio_debug;
56
57void __dprint(int type, const char *str, ...) __attribute__((format (printf, 2, 3)));
58
59#define dprint(type, str, args...) \
60 do { \
61 if ((((1 << type)) & fio_debug) == 0) \
62 break; \
63 __dprint((type), (str), ##args); \
64 } while (0) \
65
66#else
67
68static inline void dprint(int type, const char *str, ...)
69{
70}
71#endif
72
73#endif