blob: 923fa39958037c3d0aa549e9a6def4b3a9c09756 [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 Axboe3e260a42013-12-09 12:38:53 -070022 FD_RATE,
Jens Axboe4f3fe6c2014-07-09 23:01:03 +020023 FD_COMPRESS,
Jens Axboea3d741f2008-02-27 18:32:33 +010024 FD_DEBUG_MAX,
25};
26
Jens Axboe69b98d42008-05-30 22:25:32 +020027extern unsigned int fio_debug_jobno, *fio_debug_jobp;
28
Jens Axboea3d741f2008-02-27 18:32:33 +010029#ifdef FIO_INC_DEBUG
30struct debug_level {
31 const char *name;
Jens Axboe0b8d11e2012-03-02 19:44:15 +010032 const char *help;
Jens Axboea3d741f2008-02-27 18:32:33 +010033 unsigned long shift;
Jens Axboe5e1d3062008-05-23 11:55:53 +020034 unsigned int jobno;
Jens Axboea3d741f2008-02-27 18:32:33 +010035};
36extern struct debug_level debug_levels[];
37
38extern unsigned long fio_debug;
39
Jens Axboe985ee302013-02-26 08:16:43 +010040void __dprint(int type, const char *str, ...) __attribute__((format (printf, 2, 3)));
Jens Axboebf84eac2010-03-19 16:41:52 +010041
42#define dprint(type, str, args...) \
43 do { \
44 if ((((1 << type)) & fio_debug) == 0) \
45 break; \
46 __dprint((type), (str), ##args); \
47 } while (0) \
Jens Axboea3d741f2008-02-27 18:32:33 +010048
49#else
50
Jens Axboebf84eac2010-03-19 16:41:52 +010051static inline void dprint(int type, const char *str, ...)
52{
53}
Jens Axboea3d741f2008-02-27 18:32:33 +010054#endif
55
56#endif