[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160428021219.GB15055@sejong.aot.lge.com>
Date: Thu, 28 Apr 2016 11:12:19 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
CC: Arnaldo Carvalho de Melo <acme@...nel.org>,
<linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Hemant Kumar <hemant@...ux.vnet.ibm.com>,
Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>
Subject: Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to
cache the probe definitions
On Thu, Apr 28, 2016 at 03:37:42AM +0900, Masami Hiramatsu wrote:
> From: Masami Hiramatsu <masami.hiramatsu.pt@...achi.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@...achi.com>
> Signed-off-by: Masami Hiramatsu <mhiramat@...nel.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;
> +}
Powered by blists - more mailing lists