From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933483AbcIEN1P (ORCPT ); Mon, 5 Sep 2016 09:27:15 -0400 Received: from terminus.zytor.com ([198.137.202.10]:38966 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932257AbcIEN1J (ORCPT ); Mon, 5 Sep 2016 09:27:09 -0400 Date: Mon, 5 Sep 2016 06:26:26 -0700 From: tip-bot for Ravi Bangoria Message-ID: Cc: mhiramat@kernel.org, ravi.bangoria@linux.vnet.ibm.com, naveen.n.rao@linux.vnet.ibm.com, tglx@linutronix.de, acme@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org, hemant@linux.vnet.ibm.com, wangnan0@huawei.com, peterz@infradead.org, hpa@zytor.com, alexander.shishkin@linux.intel.com Reply-To: mhiramat@kernel.org, ravi.bangoria@linux.vnet.ibm.com, naveen.n.rao@linux.vnet.ibm.com, acme@redhat.com, mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, hpa@zytor.com, peterz@infradead.org, hemant@linux.vnet.ibm.com, wangnan0@huawei.com In-Reply-To: <1470214725-5023-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com> References: <1470214725-5023-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Add helper function to check if probe with variable Git-Commit-ID: b3f33f930606a55b547ac4ef5a32df2c23a44ec1 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: b3f33f930606a55b547ac4ef5a32df2c23a44ec1 Gitweb: http://git.kernel.org/tip/b3f33f930606a55b547ac4ef5a32df2c23a44ec1 Author: Ravi Bangoria AuthorDate: Wed, 3 Aug 2016 14:28:44 +0530 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 1 Sep 2016 12:42:25 -0300 perf probe: Add helper function to check if probe with variable Introduce helper function instead of inline code and replace hardcoded strings "$vars" and "$params" with their corresponding macros. perf_probe_with_var() is not declared as static since it will be called from different file in subsequent patch. Signed-off-by: Ravi Bangoria Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Hemant Kumar Cc: Naveen N. Rao Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1470214725-5023-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/probe-event.c | 22 +++++++++++++++------- tools/perf/util/probe-event.h | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 8a1e9e6..a543e9c 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1618,19 +1618,27 @@ out: return ret; } +/* Returns true if *any* ARG is either C variable, $params or $vars. */ +bool perf_probe_with_var(struct perf_probe_event *pev) +{ + int i = 0; + + for (i = 0; i < pev->nargs; i++) + if (is_c_varname(pev->args[i].var) || + !strcmp(pev->args[i].var, PROBE_ARG_PARAMS) || + !strcmp(pev->args[i].var, PROBE_ARG_VARS)) + return true; + return false; +} + /* Return true if this perf_probe_event requires debuginfo */ bool perf_probe_event_need_dwarf(struct perf_probe_event *pev) { - int i; - if (pev->point.file || pev->point.line || pev->point.lazy_line) return true; - for (i = 0; i < pev->nargs; i++) - if (is_c_varname(pev->args[i].var) || - !strcmp(pev->args[i].var, "$params") || - !strcmp(pev->args[i].var, "$vars")) - return true; + if (perf_probe_with_var(pev)) + return true; return false; } diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h index 6209408..8091d15 100644 --- a/tools/perf/util/probe-event.h +++ b/tools/perf/util/probe-event.h @@ -128,6 +128,8 @@ char *synthesize_perf_probe_point(struct perf_probe_point *pp); int perf_probe_event__copy(struct perf_probe_event *dst, struct perf_probe_event *src); +bool perf_probe_with_var(struct perf_probe_event *pev); + /* Check the perf_probe_event needs debuginfo */ bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);