Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1208807

[PATCH 04/14] perf script: Initialize callchain_param.record_mode

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 04/14] perf script: Initialize callchain_param.record_mode
Date 2015-08-17 21:20 +0200
Message-ID <pYy6S-83E-37@gated-at.bofh.it> (permalink)
References <pYy6S-83E-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Jiri Olsa <jolsa@redhat.com>

Milian Wolff reported non functional DWARF unwind under perf script. The
reason is that perf script does not properly configure
callchain_param.record_mode, which is needed by unwind code.

Stealing the code from report and leaving the place for more
initialization code in a hope we could merge it with
report__setup_sample_type one day.

Reported-by: Milian Wolff <mail@milianw.de>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Milian Wolff <milian.wolff@kdab.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20150813071724.GA21322@krava.brq.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 7b376d215e94..105332e950a9 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1561,6 +1561,22 @@ static int have_cmd(int argc, const char **argv)
 	return 0;
 }
 
+static void script__setup_sample_type(struct perf_script *script)
+{
+	struct perf_session *session = script->session;
+	u64 sample_type = perf_evlist__combined_sample_type(session->evlist);
+
+	if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {
+		if ((sample_type & PERF_SAMPLE_REGS_USER) &&
+		    (sample_type & PERF_SAMPLE_STACK_USER))
+			callchain_param.record_mode = CALLCHAIN_DWARF;
+		else if (sample_type & PERF_SAMPLE_BRANCH_STACK)
+			callchain_param.record_mode = CALLCHAIN_LBR;
+		else
+			callchain_param.record_mode = CALLCHAIN_FP;
+	}
+}
+
 int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	bool show_full_info = false;
@@ -1849,6 +1865,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
 		goto out_delete;
 
 	script.session = session;
+	script__setup_sample_type(&script);
 
 	session->itrace_synth_opts = &itrace_synth_opts;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/14] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 04/14] perf script: Initialize callchain_param.record_mode Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 02/14] perf probe: Fix to add missed brace around if block Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 05/14] perf annotate: Fix 32-bit compilation error in util/annotate.c Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 07/14] perf tools: Add a helper function to probe whether cpu-wide tracing is possible Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 08/14] perf auxtrace: Add Intel PT as an AUX area tracing type Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 11/14] perf tools: Add Intel PT log Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 03/14] perf trace: Move vfs_getname storage to per thread area Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 01/14] perf tools: Support static linking with libdw Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 09/14] perf tools: Add Intel PT packet decoder Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200
  [PATCH 06/14] perf symbols: Fix annotation of vdso Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-08-17 21:20 +0200

csiph-web