Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1166310
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 01/10] perf probe: Cut off the gcc optimization postfixes from function name |
| Date | 2015-06-16 20:30 +0200 |
| Message-ID | <pC3Mv-22f-31@gated-at.bofh.it> (permalink) |
| References | <pC3Mu-22f-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cut off the postfixes which gcc added for optimized routines from the
event name automatically generated from symbol name, since *probe-events
doesn't accept it. Those symbols will be used if we don't use debuginfo
to find target functions.
E.g. without this fix;
-----
# perf probe -va alloc_buf.isra.23
probe-definition(0): alloc_buf.isra.23
symbol:alloc_buf.isra.23 file:(null) line:0 offset:0 return:0 lazy:(null)
[...]
Opening /sys/kernel/debug/tracing/kprobe_events write=1
Added new event:
Writing event: p:probe/alloc_buf.isra.23 _text+4869328
Failed to write event: Invalid argument
Error: Failed to add events. Reason: Invalid argument (Code: -22)
-----
With this fix;
-----
perf probe -va alloc_buf.isra.23
probe-definition(0): alloc_buf.isra.23
symbol:alloc_buf.isra.23 file:(null) line:0 offset:0 return:0 lazy:(null)
[...]
Opening /sys/kernel/debug/tracing/kprobe_events write=1
Added new event:
Writing event: p:probe/alloc_buf _text+4869328
probe:alloc_buf (on alloc_buf.isra.23)
You can now use it in all perf tools, such as:
perf record -e probe:alloc_buf -aR sleep 1
-----
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naohiro Aota <naota@elisp.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20150612050820.20548.41625.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index d4cf50b91839..daa24a249e05 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2316,6 +2316,7 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
struct strlist *namelist, bool allow_suffix)
{
int i, ret;
+ char *p;
if (*base == '.')
base++;
@@ -2326,6 +2327,10 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
pr_debug("snprintf() failed: %d\n", ret);
return ret;
}
+ /* Cut off the postfixes (e.g. .const, .isra)*/
+ p = strchr(buf, '.');
+ if (p && p != buf)
+ *p = '\0';
if (!strlist__has_entry(namelist, buf))
return 0;
--
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 | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-16 20:30 +0200 [PATCH 02/10] perf tools: Replace map->referenced & maps->removed_maps with map->refcnt Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-16 20:30 +0200 [PATCH 05/10] perf tools: Introduce xyarray__reset function Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-16 20:30 +0200 [PATCH 08/10] perf stat: Introduce perf_counts__(new|delete|reset) functions Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-16 20:30 +0200 [PATCH 10/10] perf probe: Fix to return error if no probe is added Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-16 20:30 +0200 [PATCH 09/10] perf unwind: Fix a compile error Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-16 20:30 +0200 [PATCH 01/10] perf probe: Cut off the gcc optimization postfixes from function name Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-16 20:30 +0200 [PATCH 03/10] tools lib traceevent: Fix python/perf.so compiling error Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-16 20:30 +0200 [PATCH 07/10] perf tools: Move perf_evsel__(alloc|free|reset)_counts into stat object Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-16 20:30 +0200
csiph-web