blob: 3473d6f7379934da2f42309eec4daa385b5a8fed [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 Axboea3d741f2008-02-27 18:32:33 +010021 FD_DEBUG_MAX,
22};
23
Jens Axboe69b98d42008-05-30 22:25:32 +020024extern unsigned int fio_debug_jobno, *fio_debug_jobp;
25
Jens Axboea3d741f2008-02-27 18:32:33 +010026#ifdef FIO_INC_DEBUG
27struct debug_level {
28 const char *name;
29 unsigned long shift;
Jens Axboe5e1d3062008-05-23 11:55:53 +020030 unsigned int jobno;
Jens Axboea3d741f2008-02-27 18:32:33 +010031};
32extern struct debug_level debug_levels[];
33
34extern unsigned long fio_debug;
35
Jens Axboebf84eac2010-03-19 16:41:52 +010036void __dprint(int type, const char *str, ...);
37
38#define dprint(type, str, args...) \
39 do { \
40 if ((((1 << type)) & fio_debug) == 0) \
41 break; \
42 __dprint((type), (str), ##args); \
43 } while (0) \
Jens Axboea3d741f2008-02-27 18:32:33 +010044
45#else
46
Jens Axboebf84eac2010-03-19 16:41:52 +010047static inline void dprint(int type, const char *str, ...)
48{
49}
Jens Axboea3d741f2008-02-27 18:32:33 +010050#endif
51
52#endif