diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-08-16 13:24:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-16 13:42:31 -0400 |
commit | 2cec19d9d0716f8d68f1c5a87667d0387d4d252d (patch) | |
tree | af5de5945e4b1aa53c2e97028c18281471ffa1c6 /tools/perf/util | |
parent | 0d31b82dd5c54a0b1e1d789427abdcc180bc4602 (diff) |
perf tools: Factorize the dprintf definition
We have two users of dprintf: report and annotate. Another one
is coming with perf trace. Then factorize it into the debug
file.
While at it, rename dprintf() to dump_printf() so that it
doesn't conflicts with its libc homograph.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1250443461-28130-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/debug.c | 15 | ||||
-rw-r--r-- | tools/perf/util/debug.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 7cb8464abe61..8318fdee4778 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
7 | 7 | ||
8 | int verbose = 0; | 8 | int verbose = 0; |
9 | int dump_trace = 0; | ||
9 | 10 | ||
10 | int eprintf(const char *fmt, ...) | 11 | int eprintf(const char *fmt, ...) |
11 | { | 12 | { |
@@ -20,3 +21,17 @@ int eprintf(const char *fmt, ...) | |||
20 | 21 | ||
21 | return ret; | 22 | return ret; |
22 | } | 23 | } |
24 | |||
25 | int dump_printf(const char *fmt, ...) | ||
26 | { | ||
27 | va_list args; | ||
28 | int ret = 0; | ||
29 | |||
30 | if (dump_trace) { | ||
31 | va_start(args, fmt); | ||
32 | ret = vprintf(fmt, args); | ||
33 | va_end(args); | ||
34 | } | ||
35 | |||
36 | return ret; | ||
37 | } | ||
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index 2ae9090108d3..a683bd571f1c 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h | |||
@@ -1,5 +1,7 @@ | |||
1 | /* For debugging general purposes */ | 1 | /* For debugging general purposes */ |
2 | 2 | ||
3 | extern int verbose; | 3 | extern int verbose; |
4 | extern int dump_trace; | ||
4 | 5 | ||
5 | int eprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); | 6 | int eprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); |
7 | int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); | ||