From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753968AbdG3JqN (ORCPT ); Sun, 30 Jul 2017 05:46:13 -0400 Received: from terminus.zytor.com ([65.50.211.136]:36207 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750988AbdG3JqL (ORCPT ); Sun, 30 Jul 2017 05:46:11 -0400 Date: Sun, 30 Jul 2017 02:42:53 -0700 From: "tip-bot for =?UTF-8?Q?Genevi=C3=A8ve?= Bastien" Message-ID: Cc: francis.deslauriers@efficios.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, gbastien@versatic.net, hpa@zytor.com, acme@redhat.com, peterz@infradead.org, mingo@kernel.org, jdesfossez@efficios.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, mathieu.desnoyers@efficios.com Reply-To: acme@redhat.com, peterz@infradead.org, alexander.shishkin@linux.intel.com, jdesfossez@efficios.com, mingo@kernel.org, jolsa@kernel.org, mathieu.desnoyers@efficios.com, francis.deslauriers@efficios.com, gbastien@versatic.net, linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com In-Reply-To: <20170727181205.24843-2-gbastien@versatic.net> References: <20170727181205.24843-2-gbastien@versatic.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf data: Add mmap[2] events to CTF conversion Git-Commit-ID: f9f6f2a90343c5be3294d1336da055a99c28897d X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f9f6f2a90343c5be3294d1336da055a99c28897d Gitweb: http://git.kernel.org/tip/f9f6f2a90343c5be3294d1336da055a99c28897d Author: Geneviève Bastien AuthorDate: Thu, 27 Jul 2017 14:12:04 -0400 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 28 Jul 2017 16:26:06 -0300 perf data: Add mmap[2] events to CTF conversion This adds the mmap and mmap2 events to the CTF trace obtained from perf data. These events will allow CTF trace visualization tools like Trace Compass to automatically resolve the symbols of the callchain to the corresponding function or origin library. To include those events, one needs to convert with the --all option. Here follows an output of babeltrace: $ sudo perf data convert --all --to-ctf myctftrace $ babeltrace ./myctftrace [19:00:00.000000000] (+0.000000000) perf_mmap2: { cpu_id = 0 }, { pid = 638, tid = 638, start = 0x7F54AE39E000, filename = "/usr/lib/ld-2.25.so" } [19:00:00.000000000] (+0.000000000) perf_mmap2: { cpu_id = 0 }, { pid = 638, tid = 638, start = 0x7F54AE565000, filename = "/usr/lib/libudev.so.1.6.6" } [19:00:00.000000000] (+0.000000000) perf_mmap2: { cpu_id = 0 }, { pid = 638, tid = 638, start = 0x7FFC093EA000, filename = "[vdso]" } Signed-off-by: Geneviève Bastien Acked-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Francis Deslauriers Cc: Julien Desfossez Cc: Mathieu Desnoyers Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170727181205.24843-2-gbastien@versatic.net Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/data-convert-bt.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c index eeb2590..2346cec 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -76,6 +76,8 @@ struct ctf_writer { struct bt_ctf_event_class *comm_class; struct bt_ctf_event_class *exit_class; struct bt_ctf_event_class *fork_class; + struct bt_ctf_event_class *mmap_class; + struct bt_ctf_event_class *mmap2_class; }; struct convert { @@ -915,6 +917,18 @@ __FUNC_PROCESS_NON_SAMPLE(exit, __NON_SAMPLE_SET_FIELD(fork, u32, ptid); __NON_SAMPLE_SET_FIELD(fork, u64, time); ) +__FUNC_PROCESS_NON_SAMPLE(mmap, + __NON_SAMPLE_SET_FIELD(mmap, u32, pid); + __NON_SAMPLE_SET_FIELD(mmap, u32, tid); + __NON_SAMPLE_SET_FIELD(mmap, u64_hex, start); + __NON_SAMPLE_SET_FIELD(mmap, string, filename); +) +__FUNC_PROCESS_NON_SAMPLE(mmap2, + __NON_SAMPLE_SET_FIELD(mmap2, u32, pid); + __NON_SAMPLE_SET_FIELD(mmap2, u32, tid); + __NON_SAMPLE_SET_FIELD(mmap2, u64_hex, start); + __NON_SAMPLE_SET_FIELD(mmap2, string, filename); +) #undef __NON_SAMPLE_SET_FIELD #undef __FUNC_PROCESS_NON_SAMPLE @@ -1254,6 +1268,19 @@ __FUNC_ADD_NON_SAMPLE_EVENT_CLASS(exit, __NON_SAMPLE_ADD_FIELD(u64, time); ) +__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(mmap, + __NON_SAMPLE_ADD_FIELD(u32, pid); + __NON_SAMPLE_ADD_FIELD(u32, tid); + __NON_SAMPLE_ADD_FIELD(u64_hex, start); + __NON_SAMPLE_ADD_FIELD(string, filename); +) + +__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(mmap2, + __NON_SAMPLE_ADD_FIELD(u32, pid); + __NON_SAMPLE_ADD_FIELD(u32, tid); + __NON_SAMPLE_ADD_FIELD(u64_hex, start); + __NON_SAMPLE_ADD_FIELD(string, filename); +) #undef __NON_SAMPLE_ADD_FIELD #undef __FUNC_ADD_NON_SAMPLE_EVENT_CLASS @@ -1271,6 +1298,12 @@ static int setup_non_sample_events(struct ctf_writer *cw, ret = add_fork_event(cw); if (ret) return ret; + ret = add_mmap_event(cw); + if (ret) + return ret; + ret = add_mmap2_event(cw); + if (ret) + return ret; return 0; } @@ -1572,6 +1605,8 @@ int bt_convert__perf2ctf(const char *input, const char *path, c.tool.comm = process_comm_event; c.tool.exit = process_exit_event; c.tool.fork = process_fork_event; + c.tool.mmap = process_mmap_event; + c.tool.mmap2 = process_mmap2_event; } err = perf_config(convert__config, &c);