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 Axboe517a1a42013-02-27 12:32:43 +010014 pid = getpid();
Jens Axboebf84eac2010-03-19 16:41:52 +010015 if (fio_debug_jobp && *fio_debug_jobp != -1U
Jens Axboe517a1a42013-02-27 12:32:43 +010016 && pid != *fio_debug_jobp)
Jens Axboebf84eac2010-03-19 16:41:52 +010017 return;
18
Jens Axboe03a08252013-09-11 08:23:45 -060019 log_info("%-8s ", debug_levels[type].name);
20 log_info("%-5u ", (int) pid);
Jens Axboebf84eac2010-03-19 16:41:52 +010021
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