From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753984AbcFPIki (ORCPT ); Thu, 16 Jun 2016 04:40:38 -0400 Received: from terminus.zytor.com ([198.137.202.10]:33722 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751246AbcFPIke (ORCPT ); Thu, 16 Jun 2016 04:40:34 -0400 Date: Thu, 16 Jun 2016 01:39:59 -0700 From: tip-bot for Masami Hiramatsu Message-ID: 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 Reply-To: namhyung@kernel.org, hpa@zytor.com, brendan.d.gregg@gmail.com, linux-kernel@vger.kernel.org, mhiramat@kernel.org, acme@redhat.com, hemant@linux.vnet.ibm.com, masami.hiramatsu.pt@hitachi.com, ananth@linux.vnet.ibm.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org In-Reply-To: <20160615032840.31330.44412.stgit@devbox> References: <20160615032840.31330.44412.stgit@devbox> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Add --cache option to cache the probe definitions Git-Commit-ID: 2fd457a34525ea3bc609e377b46af759af8a7934 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: 2fd457a34525ea3bc609e377b46af759af8a7934 Gitweb: http://git.kernel.org/tip/2fd457a34525ea3bc609e377b46af759af8a7934 Author: Masami Hiramatsu AuthorDate: Wed, 15 Jun 2016 12:28:40 +0900 Committer: Arnaldo Carvalho de Melo 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 Signed-off-by: Masami Hiramatsu Cc: Ananth N Mavinakayanahalli Cc: Brendan Gregg Cc: Hemant Kumar Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20160615032840.31330.44412.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo --- 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;