From: Stephane Eranian <eranian@google.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
"mingo@elte.hu" <mingo@elte.hu>,
"ak@linux.intel.com" <ak@linux.intel.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung.kim@lge.com>
Subject: Re: [PATCH 1/2] perf stat: refactor aggregation code
Date: Wed, 13 Feb 2013 10:38:09 +0100 [thread overview]
Message-ID: <CABPqkBR=H5NOTjjEXRzC-tU3K+tbkYHYTzBvjyZyn3-Xu68UVw@mail.gmail.com> (raw)
In-Reply-To: <874nhgps85.fsf@sejong.aot.lge.com>
On Wed, Feb 13, 2013 at 8:50 AM, Namhyung Kim <namhyung@kernel.org> wrote:
> Hi Stephane,
>
> On Tue, 12 Feb 2013 15:09:27 +0100, Stephane Eranian wrote:
>> Refactor aggregation code by introducing
>> a single aggr_mode variable and an enum
>> for aggregation.
>>
>> Also refactor cpumap code having to do
>> with cpu to socket mappings. All in preparation
>> for extended modes, such as cpu -> core.
>>
>> Also fix socket aggregation and ensure
>> that sockets are printed in increasing order.
> [snip]
>> -static void print_aggr_socket(char *prefix)
>> +static void print_aggr(char *prefix)
>> {
>> struct perf_evsel *counter;
>> + int cpu, s, s2, id, nr;
>> u64 ena, run, val;
>> - int cpu, s, s2, sock, nr;
>>
>> - if (!sock_map)
>> + if (!(aggr_map || aggr_get_id))
>> return;
>>
>> - for (s = 0; s < sock_map->nr; s++) {
>> - sock = cpu_map__socket(sock_map, s);
>> + for (s = 0; s < aggr_map->nr; s++) {
>> + id = aggr_map->map[s];
>> list_for_each_entry(counter, &evsel_list->entries, node) {
>> val = ena = run = 0;
>> nr = 0;
> ...
>> @@ -1073,14 +1081,20 @@ static void print_stat(int argc, const char **argv)
>> fprintf(output, ":\n\n");
>> }
>>
>> - if (aggr_socket)
>> - print_aggr_socket(NULL);
>> - else if (no_aggr) {
>> - list_for_each_entry(counter, &evsel_list->entries, node)
>> - print_counter(counter, NULL);
>> - } else {
>> + switch (aggr_mode) {
>> + case AGGR_SOCKET:
>> + print_aggr(NULL);
>> + break;
>
> This line should look like this IMHO:
>
> list_for_each_entry(counter, &evsel_list->entries, node)
> print_aggr(counter, NULL);
>
> and the equivalent loop in the print_aggr() should be removed. This is
> for consistency with other formats if multiple events counted.
>
Sounds good. I will make the change.
> For instance, it'd sorting on events first and then sockets like:
>
> # time socket cpus counts events
> t0 S0 4 XXXXXX cycles
> t0 S1 4 XXXXXX cycles
> t0 S0 4 YYYY cache-misses
> t0 S1 4 YYYY cache-misses
> t1 S0 4 ZZZZZZ cycles
> ...
>
> But current code looks like sorting on sockets first instead.
>
> # time socket cpus counts events
> t0 S0 4 XXXXXX cycles
> t0 S0 4 YYYY cache-misses
> t0 S1 4 XXXXXX cycles
> t0 S1 4 YYYY cache-misses
> t1 S0 4 ZZZZZZ cycles
> ...
>
> Thanks,
> Namhyung
>
>
>> + case AGGR_GLOBAL:
>> list_for_each_entry(counter, &evsel_list->entries, node)
>> print_counter_aggr(counter, NULL);
>> + break;
>> + case AGGR_NONE:
>> + list_for_each_entry(counter, &evsel_list->entries, node)
>> + print_counter(counter, NULL);
>> + break;
>> + default:
>> + break;
>> }
next prev parent reply other threads:[~2013-02-13 9:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-12 14:09 [PATCH 0/2] perf stat: add per-core count aggregation Stephane Eranian
2013-02-12 14:09 ` [PATCH 1/2] perf stat: refactor aggregation code Stephane Eranian
2013-02-12 17:26 ` Andi Kleen
2013-02-13 7:50 ` Namhyung Kim
2013-02-13 9:38 ` Stephane Eranian [this message]
2013-02-12 14:09 ` [PATCH 2/2] perf stat: add per-core aggregation Stephane Eranian
2013-02-12 17:23 ` [PATCH 0/2] perf stat: add per-core count aggregation Andi Kleen
2013-02-12 17:26 ` Stephane Eranian
2013-02-12 17:29 ` Andi Kleen
2013-02-12 17:33 ` Stephane Eranian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABPqkBR=H5NOTjjEXRzC-tU3K+tbkYHYTzBvjyZyn3-Xu68UVw@mail.gmail.com' \
--to=eranian@google.com \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=namhyung.kim@lge.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).