Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1423466

Re: [PATCH perf/core v11 07/20] perf probe: Add --cache option to cache the probe definitions

From Masami Hiramatsu <mhiramat@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH perf/core v11 07/20] perf probe: Add --cache option to cache the probe definitions
Date 2016-06-15 23:40 +0200
Message-ID <rKqHw-7SL-19@gated-at.bofh.it> (permalink)
References <rK9GF-5v1-1@gated-at.bofh.it> <rK9GG-5v1-19@gated-at.bofh.it> <rKmXg-5xA-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 15 Jun 2016 14:38:59 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Em Wed, Jun 15, 2016 at 12:28:40PM +0900, Masami Hiramatsu escreveu:
> > From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> > 
> > Add --cache option to cache the probe definitions. This
> > just saves the result of the dwarf analysis to probe cache.
> 
> So, I applied up to this patch and will test build and send to Ingo
> today, but from this point on I think you should provide usage examples,
> i.e. use the options introduced, showing what effects it has on
> the cache, etc.

Hmm, OK, I'll add that on perf-probe.txt, but anyway, unless [8/23]
perf probe just write events in cache files, but not reuse (read)
the cache entries. IOW, it would be just a waste of disk space....

Thank you,

> 
> - Arnaldo
>  
> > Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  Changes in v11:
> >   - Check failure of probe_cache operations and warn it.
> >  Changes in v10:
> >   - Split into 5 subpatches.
> >  Changes in v6:
> >   - Remove unneeded O_APPEND from open(). (Thanks Namhyung!)
> >   - Fix to check the return value of probe_cache_entry__new and strdup.(ditto)
> >  Changes in v5:
> >   - Move probe_cache* definitions. (code cleanup)
> > 
> >  Changes in v4:
> >   - Remove cache saving failure message.
> > ---
> >  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;


-- 
Masami Hiramatsu <mhiramat@kernel.org>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH perf/core v11 00/20] perf-probe --cache and SDT support Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 03/20] perf-buildid: Rename and export build_id_cache__cachedir() Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 11/20] perf/sdt: ELF support for SDT Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 08/20] perf probe: Use cache entry if possible Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 07/20] perf probe: Add --cache option to cache the probe definitions Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
    Re: [PATCH perf/core v11 07/20] perf probe: Add --cache option to  cache the probe definitions Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-15 19:40 +0200
      Re: [PATCH perf/core v11 07/20] perf probe: Add --cache option to  cache the probe definitions Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 23:40 +0200
        Re: [PATCH perf/core v11 07/20] perf probe: Add --cache option to  cache the probe definitions Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-16 16:30 +0200
          Re: [PATCH perf/core v11 07/20] perf probe: Add --cache option to  cache the probe definitions Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-17 01:50 +0200
    [tip:perf/core] perf probe: Add --cache option to cache the probe  definitions tip-bot for Masami Hiramatsu <tipbot@zytor.com> - 2016-06-16 10:50 +0200
  [PATCH perf/core v11 01/20] perf: util: Fix rm_rf() to handle non-regular files correctly Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 02/20] perf-probe: Fix to add NULL check for strndup Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 10/20] perf probe: Remove caches when --cache is given Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 04/20] perf probe: Add perf_probe_event__copy() Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 05/20] perf probe: Recover and export synthesize_perf_probe_point() Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 06/20] perf probe-file: Introduce perf_cache interfaces Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
    [tip:perf/core] perf probe: Introduce perf_cache interfaces tip-bot for Masami Hiramatsu <tipbot@zytor.com> - 2016-06-16 10:50 +0200
  [PATCH perf/core v11 12/20] perf probe: Add group name support Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 09/20] perf probe: Show all cached probes Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:30 +0200
  [PATCH perf/core v11 13/20] perf buildid-cache: Scan and import user SDT events to probe cache Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:40 +0200
  [PATCH perf/core v11 17/20] perf: probe-cache: Add for_each_probe_cache_entry() wrapper Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:40 +0200
  [PATCH perf/core v11 18/20] perf probe: Allow wildcard for cached events Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:40 +0200
  [PATCH perf/core v11 16/20] perf-list: Skip SDTs placed in invalid binaries Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:40 +0200
  [PATCH perf/core v11 14/20] perf probe: Accept %sdt and %cached event name Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:40 +0200
  [PATCH perf/core v11 19/20] perf probe: Search SDT/cached event from all probe caches Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:40 +0200
  [PATCH perf/core v11 15/20] perf-list: Show SDT and pre-cached events Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:40 +0200
  [PATCH perf/core v11 20/20] perf probe: Support @BUILDID or @FILE suffix for SDT events Masami Hiramatsu <mhiramat@kernel.org> - 2016-06-15 05:40 +0200

csiph-web