Optimize __get_io_u() for better code foot print
[fio.git] / debug.h
CommitLineData
a3d741fa
JA
1#ifndef FIO_DEBUG_H
2#define FIO_DEBUG_H
3
4#include <assert.h>
5#include "log.h"
6
7enum {
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,
a3d741fa
JA
20 FD_DEBUG_MAX,
21};
22
69b98d4c
JA
23extern unsigned int fio_debug_jobno, *fio_debug_jobp;
24
a3d741fa
JA
25#ifdef FIO_INC_DEBUG
26struct debug_level {
27 const char *name;
28 unsigned long shift;
5e1d306e 29 unsigned int jobno;
a3d741fa
JA
30};
31extern struct debug_level debug_levels[];
32
33extern unsigned long fio_debug;
34
35#define dprint(type, str, args...) \
36 do { \
440a5981 37 pid_t __pid; \
a3d741fa
JA
38 assert(type < FD_DEBUG_MAX); \
39 if ((((1 << type)) & fio_debug) == 0) \
40 break; \
440a5981 41 __pid = getpid(); \
5e1d306e 42 if (fio_debug_jobp && *fio_debug_jobp != -1U \
440a5981 43 && __pid != *fio_debug_jobp) \
5e1d306e 44 break; \
a3d741fa 45 log_info("%-8s ", debug_levels[(type)].name); \
440a5981 46 log_info("%-5u ", (int) __pid); \
a3d741fa
JA
47 log_info(str, ##args); \
48 } while (0)
49
50#else
51
52#define dprint(type, str, args...)
53#endif
54
55#endif