blob: af71d625fc10c20433cc5a53285de61c70ad02dc [file] [log] [blame]
Jens Axboea3d741f2008-02-27 18:32:33 +01001#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,
Jens Axboecd991b92008-03-07 13:19:35 +010016 FD_DISKUTIL,
Jens Axboe5e1d3062008-05-23 11:55:53 +020017 FD_JOB,
Jens Axboe29adda32009-01-05 19:06:39 +010018 FD_MUTEX,
Jens Axboe79d16312010-03-04 12:43:20 +010019 FD_PROFILE,
Jens Axboec223da82010-03-24 13:23:53 +010020 FD_TIME,
Jens Axboeeb7976e2011-10-01 12:42:00 -060021 FD_NET,
Jens Axboea3d741f2008-02-27 18:32:33 +010022 FD_DEBUG_MAX,
23};
24
Jens Axboe69b98d42008-05-30 22:25:32 +020025extern unsigned int fio_debug_jobno, *fio_debug_jobp;
26
Jens Axboea3d741f2008-02-27 18:32:33 +010027#ifdef FIO_INC_DEBUG
28struct debug_level {
29 const char *name;
30 unsigned long shift;
Jens Axboe5e1d3062008-05-23 11:55:53 +020031 unsigned int jobno;
Jens Axboea3d741f2008-02-27 18:32:33 +010032};
33extern struct debug_level debug_levels[];
34
35extern unsigned long fio_debug;
36
Jens Axboebf84eac2010-03-19 16:41:52 +010037void __dprint(int type, const char *str, ...);
38
39#define dprint(type, str, args...) \
40 do { \
41 if ((((1 << type)) & fio_debug) == 0) \
42 break; \
43 __dprint((type), (str), ##args); \
44 } while (0) \
Jens Axboea3d741f2008-02-27 18:32:33 +010045
46#else
47
Jens Axboebf84eac2010-03-19 16:41:52 +010048static inline void dprint(int type, const char *str, ...)
49{
50}
Jens Axboea3d741f2008-02-27 18:32:33 +010051#endif
52
53#endif