[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110701111641.GE20990@elte.hu>
Date: Fri, 1 Jul 2011 13:16:41 +0200
From: Ingo Molnar <mingo@...e.hu>
To: David Ahern <dsahern@...il.com>
Cc: Anton Blanchard <anton@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf report/annotate: Add option to specify a CPU range
* David Ahern <dsahern@...il.com> wrote:
> > @@ -262,6 +271,41 @@ static int __cmd_report(void)
> > if (session == NULL)
> > return -ENOMEM;
> >
> > + if (cpu_list) {
> > + int i;
> > + struct cpu_map *map;
> > +
> > + for (i = 0; i < PERF_TYPE_MAX; ++i) {
> > + struct perf_evsel *evsel;
> > +
> > + evsel = perf_session__find_first_evtype(session, i);
> > + if (!evsel)
> > + continue;
> > +
> > + if (!(evsel->attr.sample_type & PERF_SAMPLE_CPU)) {
> > + pr_err("File does not contain CPU events. "
> > + "Remove -c option to proceed.\n");
> > + ret = -1;
> > + goto out_delete;
> > + }
> > + }
> > +
> > + map = cpu_map__new(cpu_list);
> > +
> > + for (i = 0; i < map->nr; i++) {
> > + int cpu = map->map[i];
> > +
> > + if (cpu >= MAX_NR_CPUS) {
> > + pr_err("Requested CPU %d too large. "
> > + "Consider raising MAX_NR_CPUS\n", cpu);
> > + ret = -1;
> > + goto out_delete;
> > + }
> > +
> > + set_bit(cpu, cpu_bitmap);
> > + }
> > + }
> > +
>
> It would be better to make this a function that all 3 commands
> reference -- something like perf_session__cpu_bitmap(session,
> cpu_list, cpu_bitmap) in util/session.c
Agreed. I can see how it ended up looking like this (fixing only perf
report, then adding it to top, then to script), but at this stage it
really calls for one helper that all three commands can utilize.
Very nice enhancement otherwise - might i suggest a 'perf top' hotkey
as well to limit the output to certain CPUs only? :-)
Thanks,
Ingo
--
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