Skip to content

Commit f78eaef

Browse files
Andi Kleenacmel
Andi Kleen
authored andcommitted
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 <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 330dfa2 commit f78eaef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/perf/util/debug.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
int verbose;
2020
bool dump_trace = false, quiet = false;
2121
int debug_ordered_events;
22+
static int redirect_to_stderr;
2223

2324
static int _eprintf(int level, int var, const char *fmt, va_list args)
2425
{
2526
int ret = 0;
2627

2728
if (var >= level) {
28-
if (use_browser >= 1)
29+
if (use_browser >= 1 && !redirect_to_stderr)
2930
ui_helpline__vshow(fmt, args);
3031
else
3132
ret = vfprintf(stderr, fmt, args);
@@ -145,6 +146,7 @@ static struct debug_variable {
145146
} debug_variables[] = {
146147
{ .name = "verbose", .ptr = &verbose },
147148
{ .name = "ordered-events", .ptr = &debug_ordered_events},
149+
{ .name = "stderr", .ptr = &redirect_to_stderr},
148150
{ .name = NULL, }
149151
};
150152

0 commit comments

Comments
 (0)