diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2016-07-01 17:04:01 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-07-04 19:39:00 -0300 |
commit | 8d993d96901f55d26e083390aae80fd02cbff7aa (patch) | |
tree | 06cc85b6f140b3d9833fb849ea0af17290da9493 /tools/perf/util/probe-event.c | |
parent | 060fa0c7a3e0bb4f1426ee79dfd38e2a4c80067a (diff) | |
download | linux-8d993d96901f55d26e083390aae80fd02cbff7aa.tar.gz linux-8d993d96901f55d26e083390aae80fd02cbff7aa.tar.bz2 linux-8d993d96901f55d26e083390aae80fd02cbff7aa.zip |
perf probe: Add group name support
Allow user to set group name for adding new event. Note that user must
ensure that the group name doesn't conflict with existing group name
carefully.
E.g. Existing group name can conflict with other events. Especially,
using the group name reserved for kernel modules can hide kernel
embedded events when loading modules.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146736024091.27797.9471545190066268995.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r-- | tools/perf/util/probe-event.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index f81b5dd7f1b1..0201f661ccb8 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1206,10 +1206,8 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) bool file_spec = false; /* * <Syntax> - * perf probe [EVENT=]SRC[:LN|;PTN] - * perf probe [EVENT=]FUNC[@SRC][+OFFS|%return|:LN|;PAT] - * - * TODO:Group name support + * perf probe [GRP:][EVENT=]SRC[:LN|;PTN] + * perf probe [GRP:][EVENT=]FUNC[@SRC][+OFFS|%return|:LN|;PAT] */ if (!arg) return -EINVAL; @@ -1218,11 +1216,19 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) if (ptr && *ptr == '=') { /* Event name */ *ptr = '\0'; tmp = ptr + 1; - if (strchr(arg, ':')) { - semantic_error("Group name is not supported yet.\n"); - return -ENOTSUP; - } + ptr = strchr(arg, ':'); + if (ptr) { + *ptr = '\0'; + if (!is_c_func_name(arg)) + goto not_fname; + pev->group = strdup(arg); + if (!pev->group) + return -ENOMEM; + arg = ptr + 1; + } else + pev->group = NULL; if (!is_c_func_name(arg)) { +not_fname: semantic_error("%s is bad for event name -it must " "follow C symbol-naming rule.\n", arg); return -EINVAL; @@ -1230,7 +1236,6 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) pev->event = strdup(arg); if (pev->event == NULL) return -ENOMEM; - pev->group = NULL; arg = tmp; } |