summaryrefslogtreecommitdiff
path: root/debug.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2010-03-19 08:08:06 +0100
committerJens Axboe <jens.axboe@oracle.com>2010-03-19 08:08:06 +0100
commit440a5981b37580b3c0f5109bc7f6b5a412ab67fc (patch)
treefbba32d9e679c25b144c82620cc149e7318552de /debug.h
parent9bbf57cc80d915d8cc87240276334ddd5aaac547 (diff)
downloadfio-440a5981b37580b3c0f5109bc7f6b5a412ab67fc.tar.gz
fio-440a5981b37580b3c0f5109bc7f6b5a412ab67fc.tar.bz2
Don't call getpid() in dprint() unless we are going to use it
Reported-by: David Andersen <dga@cs.cmu.edu> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'debug.h')
-rw-r--r--debug.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/debug.h b/debug.h
index 71b346d8..891c254e 100644
--- a/debug.h
+++ b/debug.h
@@ -34,15 +34,16 @@ extern unsigned long fio_debug;
#define dprint(type, str, args...) \
do { \
- pid_t pid = getpid(); \
+ pid_t __pid; \
assert(type < FD_DEBUG_MAX); \
if ((((1 << type)) & fio_debug) == 0) \
break; \
+ __pid = getpid(); \
if (fio_debug_jobp && *fio_debug_jobp != -1U \
- && pid != *fio_debug_jobp) \
+ && __pid != *fio_debug_jobp) \
break; \
log_info("%-8s ", debug_levels[(type)].name); \
- log_info("%-5u ", (int) pid); \
+ log_info("%-5u ", (int) __pid); \
log_info(str, ##args); \
} while (0)