[PATCH v5 6/7] perf/sdt: List events fetched from uprobe_events
From: Ravi Bangoria
Date: Tue Mar 14 2017 - 11:08:56 EST
List those events which are fetched from uprobe_events as 'event addr@file'
followed by hint on how these events can be deleted with 'perf probe -d'
command.
For example:
$ sudo cat /sys/kernel/debug/tracing/uprobe_events
p:sdt_libpthread/mutex_release /usr/lib64/libpthread-2.24.so:0x000000000000b126
$ sudo ./perf record -a -e sdt_libpthread:mutex_release
Matching event(s) from uprobe_events:
sdt_libpthread:mutex_release 0xb126@/usr/lib64/libpthread-2.24.so
Use 'perf probe -d <event>' to delete event(s).
Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxxxxxxx>
---
tools/perf/util/probe-event.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 7bf8783..e150de0 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -3593,6 +3593,24 @@ static void sdt_warn_multi_events(int ctr, struct perf_probe_event *pev)
ctr, pev->group, pev->event);
}
+static void print_exst_sdt_events(struct probe_trace_event *tev)
+{
+ static bool msg_head;
+
+ if (!msg_head) {
+ pr_info("Matching event(s) from uprobe_events:\n");
+ msg_head = true;
+ }
+
+ pr_info(" %s:%s 0x%" PRIx64 "@%s\n", tev->group,
+ tev->event, tev->point.address, tev->point.module);
+}
+
+static void print_exst_sdt_event_footer(void)
+{
+ pr_info("Use 'perf probe -d <event>' to delete event(s).\n\n");
+}
+
static int sdt_event_probepoint_exists(struct perf_probe_event *pev,
struct probe_trace_event *tevs,
int ntevs,
@@ -3607,10 +3625,14 @@ static int sdt_event_probepoint_exists(struct perf_probe_event *pev,
if (ret < 0)
return ret;
+ print_exst_sdt_events(&tevs[i]);
ctr++;
}
}
+ if (ctr > 0)
+ print_exst_sdt_event_footer();
+
if (ctr > 1)
sdt_warn_multi_events(ctr, pev);
@@ -3660,11 +3682,16 @@ static int sdt_merge_events(struct perf_probe_event *pev,
if (!ptrn_used)
shift_sdt_events(pev, i);
+
+ print_exst_sdt_events(&exst_tevs[j]);
ctr++;
}
}
}
+ if (ctr > 0)
+ print_exst_sdt_event_footer();
+
if (!ptrn_used || ctr == 0) {
/*
* Create probe point for all probe-cached events by
--
2.9.3