From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750829AbcGNHJf (ORCPT ); Thu, 14 Jul 2016 03:09:35 -0400 Received: from terminus.zytor.com ([198.137.202.10]:45728 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750843AbcGNHJ0 (ORCPT ); Thu, 14 Jul 2016 03:09:26 -0400 Date: Thu, 14 Jul 2016 00:08:54 -0700 From: tip-bot for Masami Hiramatsu Message-ID: Cc: hemant@linux.vnet.ibm.com, namhyung@kernel.org, tglx@linutronix.de, ananth@linux.vnet.ibm.com, brendan.d.gregg@gmail.com, mhiramat@kernel.org, peterz@infradead.org, acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org Reply-To: hemant@linux.vnet.ibm.com, namhyung@kernel.org, brendan.d.gregg@gmail.com, tglx@linutronix.de, ananth@linux.vnet.ibm.com, peterz@infradead.org, mhiramat@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org In-Reply-To: <146831794674.17065.13359473252168740430.stgit@devbox> References: <146831794674.17065.13359473252168740430.stgit@devbox> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Support a special SDT probe format Git-Commit-ID: 7e9fca51fbf8430e27fb6b29299eda575e3f00cf 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: 7e9fca51fbf8430e27fb6b29299eda575e3f00cf Gitweb: http://git.kernel.org/tip/7e9fca51fbf8430e27fb6b29299eda575e3f00cf Author: Masami Hiramatsu AuthorDate: Tue, 12 Jul 2016 19:05:46 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 13 Jul 2016 23:09:09 -0300 perf probe: Support a special SDT probe format Support a special SDT probe format which can omit the '%' prefix only if the SDT group name starts with "sdt_". So, for example both of "%sdt_libc:setjump" and "sdt_libc:setjump" are acceptable for perf probe --add. E.g. without this: # perf probe -a sdt_libc:setjmp Semantic error :There is non-digit char in line number. ... With this: # perf probe -a sdt_libc:setjmp Added new event: sdt_libc:setjmp (on %setjmp in /usr/lib64/libc-2.20.so) You can now use it in all perf tools, such as: perf record -e sdt_libc:setjmp -aR sleep 1 Suggested-by: Brendan Gregg Signed-off-by: Masami Hiramatsu Tested-by: Arnaldo Carvalho de Melo Cc: Ananth N Mavinakayanahalli Cc: Brendan Gregg Cc: Hemant Kumar Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/146831794674.17065.13359473252168740430.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/perf-probe.txt | 4 +++- tools/perf/util/probe-event.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt index 39e3870..736da44 100644 --- a/tools/perf/Documentation/perf-probe.txt +++ b/tools/perf/Documentation/perf-probe.txt @@ -152,7 +152,9 @@ Probe points are defined by following syntax. [[GROUP:]EVENT=]SRC;PTN [ARG ...] 4) Pre-defined SDT events or cached event with name - %[PROVIDER:]SDTEVENT + %[sdt_PROVIDER:]SDTEVENT + or, + sdt_PROVIDER:SDTEVENT 'EVENT' specifies the name of new event, if omitted, it will be set the name of the probed function. You can also specify a group name by 'GROUP', if omitted, set 'probe' is used for kprobe and 'probe_' is used for uprobe. Note that using existing group name can conflict with other events. Especially, using the group name reserved for kernel modules can hide embedded events in the diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index f12081e..d4f8835 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1243,9 +1243,17 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) if (!arg) return -EINVAL; - if (arg[0] == '%') { + /* + * If the probe point starts with '%', + * or starts with "sdt_" and has a ':' but no '=', + * then it should be a SDT/cached probe point. + */ + if (arg[0] == '%' || + (!strncmp(arg, "sdt_", 4) && + !!strchr(arg, ':') && !strchr(arg, '='))) { pev->sdt = true; - arg++; + if (arg[0] == '%') + arg++; } ptr = strpbrk(arg, ";=@+%");