aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2014-11-21 16:38:00 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-11-24 16:03:48 -0500
commitf78eaef0e0493f6068777a246b9c4d9d5cf2b7aa (patch)
tree7be2606e09fe5c562f8fcfa9b742388ca4eb3ec4 /tools
parent330dfa224fcc8594977785a6493ca06d124f0cfe (diff)
perf tools: Allow to force redirect pr_debug to stderr.
When debugging the tui browser I find it useful to redirect the debug log into a file. Currently it's always forced to the message line. Add an option to force it to stderr. Then it can be easily redirected. Example: [root@zoo ~]# perf --debug stderr report -vv 2> /tmp/debug [root@zoo ~]# tail /tmp/debug dso open failed, mmap: No such file or directory dso open failed, mmap: No such file or directory dso open failed, mmap: No such file or directory dso open failed, mmap: No such file or directory dso open failed, mmap: No such file or directory Using /root/.debug/.build-id/4e/841948927029fb650132253642d5dbb2c1fb93 for symbols Failed to open /tmp/perf-8831.map, continuing without symbols Failed to open /tmp/perf-12721.map, continuing without symbols Failed to open /tmp/perf-6966.map, continuing without symbols Failed to open /tmp/perf-8802.map, continuing without symbols [root@zoo ~]# Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1416605880-25055-2-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/debug.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index ba357f3226c6..ad60b2f20258 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -19,13 +19,14 @@
19int verbose; 19int verbose;
20bool dump_trace = false, quiet = false; 20bool dump_trace = false, quiet = false;
21int debug_ordered_events; 21int debug_ordered_events;
22static int redirect_to_stderr;
22 23
23static int _eprintf(int level, int var, const char *fmt, va_list args) 24static int _eprintf(int level, int var, const char *fmt, va_list args)
24{ 25{
25 int ret = 0; 26 int ret = 0;
26 27
27 if (var >= level) { 28 if (var >= level) {
28 if (use_browser >= 1) 29 if (use_browser >= 1 && !redirect_to_stderr)
29 ui_helpline__vshow(fmt, args); 30 ui_helpline__vshow(fmt, args);
30 else 31 else
31 ret = vfprintf(stderr, fmt, args); 32 ret = vfprintf(stderr, fmt, args);
@@ -145,6 +146,7 @@ static struct debug_variable {
145} debug_variables[] = { 146} debug_variables[] = {
146 { .name = "verbose", .ptr = &verbose }, 147 { .name = "verbose", .ptr = &verbose },
147 { .name = "ordered-events", .ptr = &debug_ordered_events}, 148 { .name = "ordered-events", .ptr = &debug_ordered_events},
149 { .name = "stderr", .ptr = &redirect_to_stderr},
148 { .name = NULL, } 150 { .name = NULL, }
149}; 151};
150 152