From: tip-bot for Ravi Bangoria <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
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
Subject: [tip:perf/core] perf probe: Add helper function to check if probe with variable
Date: Mon, 5 Sep 2016 06:26:26 -0700 [thread overview]
Message-ID: <tip-b3f33f930606a55b547ac4ef5a32df2c23a44ec1@git.kernel.org> (raw)
In-Reply-To: <1470214725-5023-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com>
Commit-ID: b3f33f930606a55b547ac4ef5a32df2c23a44ec1
Gitweb: http://git.kernel.org/tip/b3f33f930606a55b547ac4ef5a32df2c23a44ec1
Author: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
AuthorDate: Wed, 3 Aug 2016 14:28:44 +0530
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
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 <ravi.bangoria@linux.vnet.ibm.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
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 <acme@redhat.com>
---
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);
prev parent reply other threads:[~2016-09-05 13:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-03 8:58 [PATCH 1/2] perf probe: Helper function to check if probe with variable Ravi Bangoria
2016-08-03 8:58 ` [PATCH v2 2/2] perf uprobe: Skip prologue if program compiled without optimization Ravi Bangoria
2016-08-13 13:45 ` Ravi Bangoria
2016-08-25 12:30 ` Masami Hiramatsu
2016-08-18 9:17 ` Naveen N. Rao
2016-08-25 12:50 ` Masami Hiramatsu
2016-08-25 13:59 ` Jiri Olsa
2016-08-25 15:17 ` Arnaldo Carvalho de Melo
2016-08-25 15:44 ` Jiri Olsa
2016-08-26 19:30 ` Arnaldo Carvalho de Melo
2016-08-26 19:54 ` Arnaldo Carvalho de Melo
2016-08-27 0:27 ` Masami Hiramatsu
2016-08-29 15:10 ` [PATCH] perf probe: Move dwarf specific functions to dwarf-aux.c Ravi Bangoria
2016-08-29 22:53 ` Masami Hiramatsu
2016-08-30 8:39 ` [PATCH v2] " Ravi Bangoria
2016-08-30 14:10 ` Masami Hiramatsu
2016-09-05 13:27 ` [tip:perf/core] " tip-bot for Ravi Bangoria
2016-08-29 8:09 ` [PATCH v2 2/2] perf uprobe: Skip prologue if program compiled without optimization Ravi Bangoria
2016-08-29 8:08 ` Ravi Bangoria
2016-09-05 13:26 ` [tip:perf/core] " tip-bot for Ravi Bangoria
2016-08-25 12:32 ` [PATCH 1/2] perf probe: Helper function to check if probe with variable Masami Hiramatsu
2016-09-05 13:26 ` tip-bot for Ravi Bangoria [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-b3f33f930606a55b547ac4ef5a32df2c23a44ec1@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=hemant@linux.vnet.ibm.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox