aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien <gbastien@versatic.net>2017-07-27 14:12:04 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-07-28 15:26:06 -0400
commitf9f6f2a90343c5be3294d1336da055a99c28897d (patch)
treed4ace007067c06d550bea4d98714240e4587f84d
parenta3073c8e590d7baa5a6cb01438cb945c92bfcd91 (diff)
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 <gbastien@versatic.net> Acked-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Francis Deslauriers <francis.deslauriers@efficios.com> Cc: Julien Desfossez <jdesfossez@efficios.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20170727181205.24843-2-gbastien@versatic.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/data-convert-bt.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index eeb2590a3ddf..2346cecb8ea2 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -76,6 +76,8 @@ struct ctf_writer {
76 struct bt_ctf_event_class *comm_class; 76 struct bt_ctf_event_class *comm_class;
77 struct bt_ctf_event_class *exit_class; 77 struct bt_ctf_event_class *exit_class;
78 struct bt_ctf_event_class *fork_class; 78 struct bt_ctf_event_class *fork_class;
79 struct bt_ctf_event_class *mmap_class;
80 struct bt_ctf_event_class *mmap2_class;
79}; 81};
80 82
81struct convert { 83struct convert {
@@ -915,6 +917,18 @@ __FUNC_PROCESS_NON_SAMPLE(exit,
915 __NON_SAMPLE_SET_FIELD(fork, u32, ptid); 917 __NON_SAMPLE_SET_FIELD(fork, u32, ptid);
916 __NON_SAMPLE_SET_FIELD(fork, u64, time); 918 __NON_SAMPLE_SET_FIELD(fork, u64, time);
917) 919)
920__FUNC_PROCESS_NON_SAMPLE(mmap,
921 __NON_SAMPLE_SET_FIELD(mmap, u32, pid);
922 __NON_SAMPLE_SET_FIELD(mmap, u32, tid);
923 __NON_SAMPLE_SET_FIELD(mmap, u64_hex, start);
924 __NON_SAMPLE_SET_FIELD(mmap, string, filename);
925)
926__FUNC_PROCESS_NON_SAMPLE(mmap2,
927 __NON_SAMPLE_SET_FIELD(mmap2, u32, pid);
928 __NON_SAMPLE_SET_FIELD(mmap2, u32, tid);
929 __NON_SAMPLE_SET_FIELD(mmap2, u64_hex, start);
930 __NON_SAMPLE_SET_FIELD(mmap2, string, filename);
931)
918#undef __NON_SAMPLE_SET_FIELD 932#undef __NON_SAMPLE_SET_FIELD
919#undef __FUNC_PROCESS_NON_SAMPLE 933#undef __FUNC_PROCESS_NON_SAMPLE
920 934
@@ -1254,6 +1268,19 @@ __FUNC_ADD_NON_SAMPLE_EVENT_CLASS(exit,
1254 __NON_SAMPLE_ADD_FIELD(u64, time); 1268 __NON_SAMPLE_ADD_FIELD(u64, time);
1255) 1269)
1256 1270
1271__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(mmap,
1272 __NON_SAMPLE_ADD_FIELD(u32, pid);
1273 __NON_SAMPLE_ADD_FIELD(u32, tid);
1274 __NON_SAMPLE_ADD_FIELD(u64_hex, start);
1275 __NON_SAMPLE_ADD_FIELD(string, filename);
1276)
1277
1278__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(mmap2,
1279 __NON_SAMPLE_ADD_FIELD(u32, pid);
1280 __NON_SAMPLE_ADD_FIELD(u32, tid);
1281 __NON_SAMPLE_ADD_FIELD(u64_hex, start);
1282 __NON_SAMPLE_ADD_FIELD(string, filename);
1283)
1257#undef __NON_SAMPLE_ADD_FIELD 1284#undef __NON_SAMPLE_ADD_FIELD
1258#undef __FUNC_ADD_NON_SAMPLE_EVENT_CLASS 1285#undef __FUNC_ADD_NON_SAMPLE_EVENT_CLASS
1259 1286
@@ -1271,6 +1298,12 @@ static int setup_non_sample_events(struct ctf_writer *cw,
1271 ret = add_fork_event(cw); 1298 ret = add_fork_event(cw);
1272 if (ret) 1299 if (ret)
1273 return ret; 1300 return ret;
1301 ret = add_mmap_event(cw);
1302 if (ret)
1303 return ret;
1304 ret = add_mmap2_event(cw);
1305 if (ret)
1306 return ret;
1274 return 0; 1307 return 0;
1275} 1308}
1276 1309
@@ -1572,6 +1605,8 @@ int bt_convert__perf2ctf(const char *input, const char *path,
1572 c.tool.comm = process_comm_event; 1605 c.tool.comm = process_comm_event;
1573 c.tool.exit = process_exit_event; 1606 c.tool.exit = process_exit_event;
1574 c.tool.fork = process_fork_event; 1607 c.tool.fork = process_fork_event;
1608 c.tool.mmap = process_mmap_event;
1609 c.tool.mmap2 = process_mmap2_event;
1575 } 1610 }
1576 1611
1577 err = perf_config(convert__config, &c); 1612 err = perf_config(convert__config, &c);