From aad2b21c151273fa7abc419dac51a980eff1dd17 Mon Sep 17 00:00:00 2001 From: Kan Liang Date: Mon, 5 Jan 2015 13:23:04 -0500 Subject: perf tools: Enable LBR call stack support Currently, there are two call chain recording options, fp and dwarf. Haswell has a new feature that utilizes the existing LBR facility to record call chains. Kernel side LBR support code provides this as a third option to record call chains. This patch enables the lbr call stack support on the tooling side. LBR call stack has some limitations: - It reuses current LBR facility, so LBR call stack and branch record can not be enabled at the same time. - It is only available for user-space callchains. However, it also offers some advantages: - LBR call stack can work on user apps which don't have frame-pointers or dwarf debug info compiled. It is a good alternative when nothing else works. Tested-by: Jiri Olsa Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Cc: Adrian Hunter Cc: Anshuman Khandual Cc: Arnaldo Carvalho de Melo Cc: Cody P Schafer Cc: David Ahern Cc: Don Zickus Cc: Jacob Shin Cc: Jiri Olsa Cc: Linus Torvalds Cc: Masanari Iida Cc: Namhyung Kim Cc: Paul Mackerras Cc: Rodrigo Campos Cc: Stephane Eranian Cc: Sukadev Bhattiprolu Link: http://lkml.kernel.org/r/1420482185-29830-2-git-send-email-kan.liang@intel.com Signed-off-by: Ingo Molnar --- tools/perf/util/callchain.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools/perf/util/callchain.c') diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 14e7a123d43b..9f643ee77001 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c @@ -97,6 +97,14 @@ int parse_callchain_record_opt(const char *arg) callchain_param.dump_size = size; } #endif /* HAVE_DWARF_UNWIND_SUPPORT */ + } else if (!strncmp(name, "lbr", sizeof("lbr"))) { + if (!strtok_r(NULL, ",", &saveptr)) { + callchain_param.record_mode = CALLCHAIN_LBR; + ret = 0; + } else + pr_err("callchain: No more arguments " + "needed for --call-graph lbr\n"); + break; } else { pr_err("callchain: Unknown --call-graph option " "value: %s\n", arg); -- cgit v1.2.3-59-g8ed1b