Merge branch 'master' of ssh://brick.kernel.dk/data/git/fio
[fio.git] / debug.c
1 #include <stdarg.h>
2 #include <sys/types.h>
3 #include <unistd.h>
4 #include "debug.h"
5
6 #ifdef FIO_INC_DEBUG
7 void __dprint(int type, const char *str, ...)
8 {
9         va_list args;
10         pid_t pid;
11
12         assert(type < FD_DEBUG_MAX);
13
14         if (fio_debug_jobp && *fio_debug_jobp != -1U
15             && (pid = getpid() != *fio_debug_jobp))
16                 return;
17
18         log_local("%-8s ", debug_levels[type].name);
19         log_local("%-5u ", (int) pid);
20
21         va_start(args, str);
22         log_valist(str, args);
23         va_end(args);
24 }
25 #endif