Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755347AbdCPQnG (ORCPT ); Thu, 16 Mar 2017 12:43:06 -0400 Received: from terminus.zytor.com ([65.50.211.136]:60004 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbdCPQnE (ORCPT ); Thu, 16 Mar 2017 12:43:04 -0400 Date: Thu, 16 Mar 2017 09:34:10 -0700 From: tip-bot for Ravi Bangoria Message-ID: Cc: hekuang@huawei.com, hemant@linux.vnet.ibm.com, ravi.bangoria@linux.vnet.ibm.com, mhiramat@kernel.org, treeze.taeung@gmail.com, mingo@kernel.org, brendan.d.gregg@gmail.com, hpa@zytor.com, adrian.hunter@intel.com, tglx@linutronix.de, jolsa@kernel.org, ak@linux.intel.com, wangnan0@huawei.com, peterz@infradead.org, naveen.n.rao@linux.vnet.ibm.com, mathieu.poirier@linaro.org, alexander.shishkin@linux.intel.com, ananth@in.ibm.com, sukadev@linux.vnet.ibm.com, acme@redhat.com, linux-kernel@vger.kernel.org Reply-To: mingo@kernel.org, treeze.taeung@gmail.com, hekuang@huawei.com, hemant@linux.vnet.ibm.com, ravi.bangoria@linux.vnet.ibm.com, mhiramat@kernel.org, ananth@in.ibm.com, sukadev@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, acme@redhat.com, naveen.n.rao@linux.vnet.ibm.com, mathieu.poirier@linaro.org, alexander.shishkin@linux.intel.com, tglx@linutronix.de, jolsa@kernel.org, ak@linux.intel.com, wangnan0@huawei.com, peterz@infradead.org, brendan.d.gregg@gmail.com, adrian.hunter@intel.com, hpa@zytor.com In-Reply-To: <20170314150658.7065-2-ravi.bangoria@linux.vnet.ibm.com> References: <20170314150658.7065-2-ravi.bangoria@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Introduce util func is_sdt_event() Git-Commit-ID: af9100ad149cf31a1ab1160f71bb4025443dbdb6 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 Content-Length: 3153 Lines: 90 Commit-ID: af9100ad149cf31a1ab1160f71bb4025443dbdb6 Gitweb: http://git.kernel.org/tip/af9100ad149cf31a1ab1160f71bb4025443dbdb6 Author: Ravi Bangoria AuthorDate: Tue, 14 Mar 2017 20:36:52 +0530 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 15 Mar 2017 17:48:37 -0300 perf probe: Introduce util func is_sdt_event() Factor out the SDT event name checking routine as is_sdt_event(). Signed-off-by: Ravi Bangoria Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ananth N Mavinakayanahalli Cc: Andi Kleen Cc: Brendan Gregg Cc: He Kuang Cc: Hemant Kumar Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Mathieu Poirier Cc: Naveen N. Rao Cc: Peter Zijlstra Cc: Sukadev Bhattiprolu Cc: Taeung Song Cc: Wang Nan Link: http://lkml.kernel.org/r/20170314150658.7065-2-ravi.bangoria@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.h | 20 ++++++++++++++++++++ tools/perf/util/probe-event.c | 9 +-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 1af6a26..8c72b0f 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -8,6 +8,7 @@ #include #include #include +#include struct list_head; struct perf_evsel; @@ -196,4 +197,23 @@ int is_valid_tracepoint(const char *event_string); int valid_event_mount(const char *eventfs); char *parse_events_formats_error_string(char *additional_terms); +#ifdef HAVE_LIBELF_SUPPORT +/* + * If the probe point starts with '%', + * or starts with "sdt_" and has a ':' but no '=', + * then it should be a SDT/cached probe point. + */ +static inline bool is_sdt_event(char *str) +{ + return (str[0] == '%' || + (!strncmp(str, "sdt_", 4) && + !!strchr(str, ':') && !strchr(str, '='))); +} +#else +static inline bool is_sdt_event(char *str __maybe_unused) +{ + return false; +} +#endif /* HAVE_LIBELF_SUPPORT */ + #endif /* __PERF_PARSE_EVENTS_H */ diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index c9bdc9d..b19d178 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1341,14 +1341,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) if (!arg) return -EINVAL; - /* - * 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, '='))) { + if (is_sdt_event(arg)) { pev->sdt = true; if (arg[0] == '%') arg++;