From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, hemant@linux.vnet.ibm.com, namhyung@kernel.org,
brendan.d.gregg@gmail.com, hpa@zytor.com, mhiramat@kernel.org,
linux-kernel@vger.kernel.org, mingo@kernel.org,
peterz@infradead.org, ananth@linux.vnet.ibm.com,
tglx@linutronix.de, masami.hiramatsu.pt@hitachi.com
Subject: [tip:perf/core] perf probe: Add --cache option to cache the probe definitions
Date: Thu, 16 Jun 2016 01:39:59 -0700 [thread overview]
Message-ID: <tip-2fd457a34525ea3bc609e377b46af759af8a7934@git.kernel.org> (raw)
In-Reply-To: <20160615032840.31330.44412.stgit@devbox>
Commit-ID: 2fd457a34525ea3bc609e377b46af759af8a7934
Gitweb: http://git.kernel.org/tip/2fd457a34525ea3bc609e377b46af759af8a7934
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Wed, 15 Jun 2016 12:28:40 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 15 Jun 2016 14:34:42 -0300
perf probe: Add --cache option to cache the probe definitions
Add --cache option to cache the probe definitions. This just saves the
result of the dwarf analysis to probe cache.
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: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160615032840.31330.44412.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-probe.txt | 4 ++++
tools/perf/builtin-probe.c | 1 +
tools/perf/util/probe-event.c | 9 +++++++++
tools/perf/util/probe-event.h | 1 +
4 files changed, 15 insertions(+)
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt
index 3a8a9ba..947db6f 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -109,6 +109,10 @@ OPTIONS
Dry run. With this option, --add and --del doesn't execute actual
adding and removal operations.
+--cache::
+ Cache the probes (with --add option). Any events which successfully added
+ are also stored in the cache file.
+
--max-probes=NUM::
Set the maximum number of probe points for an event. Default is 128.
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 9af859b..6d7ab431 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -512,6 +512,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
"Enable symbol demangling"),
OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
"Enable kernel symbol demangling"),
+ OPT_BOOLEAN(0, "cache", &probe_conf.cache, "Manipulate probe cache"),
OPT_END()
};
int ret;
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index cbc8a8b..084756c 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2514,6 +2514,7 @@ static int __add_probe_trace_events(struct perf_probe_event *pev,
{
int i, fd, ret;
struct probe_trace_event *tev = NULL;
+ struct probe_cache *cache = NULL;
struct strlist *namelist;
fd = probe_file__open(PF_FL_RW | (pev->uprobes ? PF_FL_UPROBE : 0));
@@ -2555,6 +2556,14 @@ static int __add_probe_trace_events(struct perf_probe_event *pev,
}
if (ret == -EINVAL && pev->uprobes)
warn_uprobe_event_compat(tev);
+ if (ret == 0 && probe_conf.cache) {
+ cache = probe_cache__new(pev->target);
+ if (!cache ||
+ probe_cache__add_entry(cache, pev, tevs, ntevs) < 0 ||
+ probe_cache__commit(cache) < 0)
+ pr_warning("Failed to add event to probe cache\n");
+ probe_cache__delete(cache);
+ }
strlist__delete(namelist);
close_out:
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
index 0b024ba..432b690 100644
--- a/tools/perf/util/probe-event.h
+++ b/tools/perf/util/probe-event.h
@@ -12,6 +12,7 @@ struct probe_conf {
bool show_location_range;
bool force_add;
bool no_inlines;
+ bool cache;
int max_probes;
};
extern struct probe_conf probe_conf;
next prev parent reply other threads:[~2016-06-16 8:40 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-15 3:27 [PATCH perf/core v11 00/20] perf-probe --cache and SDT support Masami Hiramatsu
2016-06-15 3:27 ` [PATCH perf/core v11 01/20] perf: util: Fix rm_rf() to handle non-regular files correctly Masami Hiramatsu
2016-06-15 3:27 ` [PATCH perf/core v11 02/20] perf-probe: Fix to add NULL check for strndup Masami Hiramatsu
2016-06-15 3:28 ` [PATCH perf/core v11 03/20] perf-buildid: Rename and export build_id_cache__cachedir() Masami Hiramatsu
2016-06-15 3:28 ` [PATCH perf/core v11 04/20] perf probe: Add perf_probe_event__copy() Masami Hiramatsu
2016-06-15 3:28 ` [PATCH perf/core v11 05/20] perf probe: Recover and export synthesize_perf_probe_point() Masami Hiramatsu
2016-06-15 3:28 ` [PATCH perf/core v11 06/20] perf probe-file: Introduce perf_cache interfaces Masami Hiramatsu
2016-06-16 8:39 ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2016-06-15 3:28 ` [PATCH perf/core v11 07/20] perf probe: Add --cache option to cache the probe definitions Masami Hiramatsu
2016-06-15 17:38 ` Arnaldo Carvalho de Melo
2016-06-15 21:38 ` Masami Hiramatsu
2016-06-16 14:29 ` Arnaldo Carvalho de Melo
2016-06-16 23:48 ` Masami Hiramatsu
2016-06-16 8:39 ` tip-bot for Masami Hiramatsu [this message]
2016-06-15 3:28 ` [PATCH perf/core v11 08/20] perf probe: Use cache entry if possible Masami Hiramatsu
2016-06-15 3:29 ` [PATCH perf/core v11 09/20] perf probe: Show all cached probes Masami Hiramatsu
2016-06-15 3:29 ` [PATCH perf/core v11 10/20] perf probe: Remove caches when --cache is given Masami Hiramatsu
2016-06-15 3:29 ` [PATCH perf/core v11 11/20] perf/sdt: ELF support for SDT Masami Hiramatsu
2016-06-15 3:29 ` [PATCH perf/core v11 12/20] perf probe: Add group name support Masami Hiramatsu
2016-06-15 3:29 ` [PATCH perf/core v11 13/20] perf buildid-cache: Scan and import user SDT events to probe cache Masami Hiramatsu
2016-06-15 3:29 ` [PATCH perf/core v11 14/20] perf probe: Accept %sdt and %cached event name Masami Hiramatsu
2016-06-15 3:30 ` [PATCH perf/core v11 15/20] perf-list: Show SDT and pre-cached events Masami Hiramatsu
2016-06-15 3:30 ` [PATCH perf/core v11 16/20] perf-list: Skip SDTs placed in invalid binaries Masami Hiramatsu
2016-06-15 3:30 ` [PATCH perf/core v11 17/20] perf: probe-cache: Add for_each_probe_cache_entry() wrapper Masami Hiramatsu
2016-06-15 3:30 ` [PATCH perf/core v11 18/20] perf probe: Allow wildcard for cached events Masami Hiramatsu
2016-06-15 3:30 ` [PATCH perf/core v11 19/20] perf probe: Search SDT/cached event from all probe caches Masami Hiramatsu
2016-06-15 3:30 ` [PATCH perf/core v11 20/20] perf probe: Support @BUILDID or @FILE suffix for SDT events Masami Hiramatsu
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-2fd457a34525ea3bc609e377b46af759af8a7934@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=ananth@linux.vnet.ibm.com \
--cc=brendan.d.gregg@gmail.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=masami.hiramatsu.pt@hitachi.com \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).