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


Groups > linux.kernel > #1389768

Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to cache the probe definitions

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to cache the probe definitions
Date 2016-04-28 04:20 +0200
Message-ID <rsJIB-3C4-1@gated-at.bofh.it> (permalink)
References <rsCxs-5Ye-11@gated-at.bofh.it> <rsCxt-5Ye-49@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Apr 28, 2016 at 03:37:42AM +0900, Masami Hiramatsu wrote:
> 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.
> 
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  Changes in v5:
>   - Move probe_cache* definitions. (code cleanup)
> 
>  Changes in v4:
>   - Remove cache saving failure message.
> ---

[snip]
> +static int probe_cache__load(struct probe_cache *pcache)
> +{
> +	struct probe_cache_entry *entry = NULL;
> +	char buf[MAX_CMDLEN], *p;
> +	int ret = 0;
> +	FILE *fp;
> +
> +	fp = fdopen(dup(pcache->fd), "r");
> +	while (!feof(fp)) {
> +		if (!fgets(buf, MAX_CMDLEN, fp))
> +			break;
> +		p = strchr(buf, '\n');
> +		if (p)
> +			*p = '\0';
> +		if (buf[0] == '#') {	/* #perf_probe_event */
> +			entry = probe_cache_entry__new(NULL);

The probe_cache_entry__new() can fail.

Thanks,
Namhyung


> +			entry->spev = strdup(buf + 1);
> +			ret = parse_perf_probe_command(buf + 1, &entry->pev);
> +			if (!entry->spev || ret < 0) {
> +				probe_cache_entry__delete(entry);
> +				goto out;
> +			}
> +			list_add_tail(&entry->list, &pcache->list);
> +		} else {	/* trace_probe_event */
> +			if (!entry) {
> +				ret = -EINVAL;
> +				goto out;
> +			}
> +			strlist__add(entry->tevlist, buf);
> +		}
> +	}
> +out:
> +	fclose(fp);
> +	return ret;
> +}

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


Thread

[PATCH perf/core v5 00/15] perf-probe --cache and SDT support Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
  [PATCH perf/core v5 07/15] perf probe: Remove caches when --cache is given Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
  [PATCH perf/core v5 03/15] perf-buildid-cache: Use lsdir for looking up buildid caches Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
  [PATCH perf/core v5 15/15] perf probe: Support @BUILDID or @FILE suffix for SDT events Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
  [PATCH perf/core v5 13/15] perf-list: Skip SDTs placed in invalid binaries Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
  [PATCH perf/core v5 02/15] perf-buildid-cache: Use path/to/bin/buildid/elf instead of path/to/bin/buildid Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
    Re: [PATCH perf/core v5 02/15] perf-buildid-cache: Use  path/to/bin/buildid/elf instead of path/to/bin/buildid Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 23:20 +0200
      Re: [PATCH perf/core v5 02/15] perf-buildid-cache: Use  path/to/bin/buildid/elf instead of path/to/bin/buildid Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-28 04:00 +0200
    Re: [PATCH perf/core v5 02/15] perf-buildid-cache: Use  path/to/bin/buildid/elf instead of path/to/bin/buildid Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 23:30 +0200
      Re: [PATCH perf/core v5 02/15] perf-buildid-cache: Use  path/to/bin/buildid/elf instead of path/to/bin/buildid Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-28 04:00 +0200
    Re: [PATCH perf/core v5 02/15] perf-buildid-cache: Use  path/to/bin/buildid/elf instead of path/to/bin/buildid Namhyung Kim <namhyung@kernel.org> - 2016-04-28 03:30 +0200
      Re: [PATCH perf/core v5 02/15] perf-buildid-cache: Use  path/to/bin/buildid/elf instead of path/to/bin/buildid Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 01:00 +0200
  [PATCH perf/core v5 04/15] perf probe: Add --cache option to cache the probe definitions Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
    Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to  cache the probe definitions Namhyung Kim <namhyung@kernel.org> - 2016-04-28 04:20 +0200
      Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to  cache the probe definitions Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 01:20 +0200
    Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to  cache the probe definitions Namhyung Kim <namhyung@kernel.org> - 2016-04-28 04:40 +0200
      Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to  cache the probe definitions Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 01:10 +0200
  [PATCH perf/core v5 14/15] perf probe: Allow wildcard for cached events Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
    Re: [PATCH perf/core v5 14/15] perf probe: Allow wildcard for  cached events Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:50 +0200
      [PATCH perf/core v5.1 14/15] perf probe: Allow wildcard for cached events Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 21:20 +0200
        Re: [PATCH perf/core v5.1 14/15] perf probe: Allow wildcard for cached  events Hemant Kumar <hemant@linux.vnet.ibm.com> - 2016-04-27 22:40 +0200
  [PATCH perf/core v5 12/15] perf-list: Show SDT and pre-cached events Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
    Re: [PATCH perf/core v5 12/15] perf-list: Show SDT and pre-cached  events Hemant Kumar <hemant@linux.vnet.ibm.com> - 2016-04-27 22:50 +0200
  [PATCH perf/core v5 11/15] perf probe: Accept %sdt and %cached event name Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
    Re: [PATCH perf/core v5 11/15] perf probe: Accept %sdt and %cached  event name Namhyung Kim <namhyung@kernel.org> - 2016-04-28 07:30 +0200
      Re: [PATCH perf/core v5 11/15] perf probe: Accept %sdt and %cached  event name Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 02:20 +0200
  [PATCH perf/core v5 09/15] perf probe: Add group name support Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-27 20:40 +0200
  Re: [PATCH perf/core v5 00/15] perf-probe --cache and SDT support Hemant Kumar <hemant@linux.vnet.ibm.com> - 2016-04-29 16:00 +0200

csiph-web