[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52676979.7020909@gmail.com>
Date: Wed, 23 Oct 2013 07:15:21 +0100
From: David Ahern <dsahern@...il.com>
To: Adrian Hunter <adrian.hunter@...el.com>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>
CC: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Frederic Weisbecker <fweisbec@...il.com>,
Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
Namhyung Kim <namhyung@...il.com>,
Paul Mackerras <paulus@...ba.org>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH V2 04/14] perf script: Set up output options for in-stream
attributes
On 10/22/13 8:34 AM, Adrian Hunter wrote:
> +static int process_attr(struct perf_tool *tool, union perf_event *event,
> + struct perf_evlist **pevlist)
> +{
> + struct perf_script *scr = container_of(tool, struct perf_script, tool);
> + struct perf_evlist *evlist;
> + struct perf_evsel *evsel, *pos;
> + int err;
> +
> + err = perf_event__process_attr(tool, event, pevlist);
> + if (err)
> + return err;
> +
> + evlist = *pevlist;
> + evsel = perf_evlist__last(*pevlist);
This assumes new entries are added to the end of evlist in
perf_event__process_attr. Would be better to change it to return the
newly created evsel so you don't need to look it up after adding it.
> +
> + if (evsel->attr.type >= PERF_TYPE_MAX)
> + return 0;
> +
> + list_for_each_entry(pos, &evlist->entries, node) {
> + if (pos->attr.type == evsel->attr.type && pos != evsel)
> + return 0;
> + }
What's the point of this loop?
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists