blob: 013cd53c214debe2cbb7be1ca8842c436390ff96 [file] [log] [blame]
Jens Axboebf84eac2010-03-19 16:41:52 +01001#include <stdarg.h>
2#include <sys/types.h>
3#include <unistd.h>
4#include "debug.h"
5
Jens Axboe2d5c40e2010-03-19 19:09:37 +01006#ifdef FIO_INC_DEBUG
Jens Axboebf84eac2010-03-19 16:41:52 +01007void __dprint(int type, const char *str, ...)
8{
9 va_list args;
10 pid_t pid;
11
12 assert(type < FD_DEBUG_MAX);
13
Jens Axboebf84eac2010-03-19 16:41:52 +010014 pid = getpid();
15 if (fio_debug_jobp && *fio_debug_jobp != -1U
16 && pid != *fio_debug_jobp)
17 return;
18
Jens Axboe2d5c40e2010-03-19 19:09:37 +010019 log_info("%-8s ", debug_levels[type].name);
Jens Axboebf84eac2010-03-19 16:41:52 +010020 log_info("%-5u ", (int) pid);
21
22 va_start(args, str);
Jens Axboed048ba62010-03-19 16:50:37 +010023 log_valist(str, args);
Jens Axboebf84eac2010-03-19 16:41:52 +010024 va_end(args);
25}
Jens Axboe2d5c40e2010-03-19 19:09:37 +010026#endif