Re: [PATCH 01/12] perf tools: Keep group information

From: Namhyung Kim
Date: Mon Nov 12 2012 - 20:29:44 EST


On Mon, 12 Nov 2012 14:08:33 -0300, Arnaldo Carvalho de Melo wrote:
> Em Sat, Nov 10, 2012 at 01:43:23AM +0900, Namhyung Kim escreveu:
>> From: Namhyung Kim <namhyung.kim@xxxxxxx>
>>
>> Add a few of group-related field in struct perf_{evlist,evsel} so that
>> the group information in a evlist can be known easily. It only counts
>> groups which have more than 1 members since leader-only groups are
>> treated as non-group events.
>
> We don't need to add a group_idx, we can get it using evsel->idx -
> evsel->leader->idx, interdiff of this patch to what I think is
> equivalent:

Looks good to me. Just a comment below..

>
> diff -u b/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> --- b/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -111,18 +111,16 @@
> void __perf_evlist__set_leader(struct list_head *list)
> {
> struct perf_evsel *evsel, *leader;
> - int count = 0;
>
> leader = list_entry(list->next, struct perf_evsel, node);
> + evsel = list_entry(list->prev, struct perf_evsel, node);
> leader->leader = NULL;
> + leader->nr_members = evsel->idx - leader->idx + 1;

This will lead a off-by-one difference with my patches. I chose to use
0 nr_members for leader-only group. It was used for an additional
allocation of group stats but it seems that it's not needed anymore
with the hist_link change.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/