perf tools: callchain: Fix 'perf report' display to be callchain by default

If we recorded with -g option to record the callchain, right now
we require a -g option to perf report as well - and people reported
this as unnecessary complication: the user already specified -g
once, no need to require it a second time.

So if the recording includes call-chains, display the callchain by
default from perf report.

( The user can override this default using "-g none" option from
  perf report. )

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: 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: <1249690585-9145-3-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Frederic Weisbecker 2009-08-08 02:16:24 +02:00 committed by Ingo Molnar
parent b0efe213f8
commit b1a88349c3
2 changed files with 16 additions and 1 deletions

View file

@ -68,7 +68,7 @@ static int callchain;
static static
struct callchain_param callchain_param = { struct callchain_param callchain_param = {
.mode = CHAIN_GRAPH_ABS, .mode = CHAIN_GRAPH_REL,
.min_percent = 0.5 .min_percent = 0.5
}; };
@ -1836,6 +1836,13 @@ static int __cmd_report(void)
" -g?\n"); " -g?\n");
exit(-1); exit(-1);
} }
} else if (callchain_param.mode != CHAIN_NONE && !callchain) {
callchain = 1;
if (register_callchain_param(&callchain_param) < 0) {
fprintf(stderr, "Can't register callchain"
" params\n");
exit(-1);
}
} }
if (load_kernel() < 0) { if (load_kernel() < 0) {
@ -1974,6 +1981,13 @@ parse_callchain_opt(const struct option *opt __used, const char *arg,
else if (!strncmp(tok, "fractal", strlen(arg))) else if (!strncmp(tok, "fractal", strlen(arg)))
callchain_param.mode = CHAIN_GRAPH_REL; callchain_param.mode = CHAIN_GRAPH_REL;
else if (!strncmp(tok, "none", strlen(arg))) {
callchain_param.mode = CHAIN_NONE;
callchain = 0;
return 0;
}
else else
return -1; return -1;

View file

@ -7,6 +7,7 @@
#include "symbol.h" #include "symbol.h"
enum chain_mode { enum chain_mode {
CHAIN_NONE,
CHAIN_FLAT, CHAIN_FLAT,
CHAIN_GRAPH_ABS, CHAIN_GRAPH_ABS,
CHAIN_GRAPH_REL CHAIN_GRAPH_REL