Re: [PATCH 05/16] perf tools: Keep group information
From: Namhyung Kim
Date: Fri Sep 28 2012 - 00:57:31 EST
Hi Jiri,
On Thu, 27 Sep 2012 19:03:52 +0200, Jiri Olsa wrote:
>> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
>> index bf5d033ee1b4..3c52d0ab9270 100644
>> --- a/tools/perf/util/parse-events.c
>> +++ b/tools/perf/util/parse-events.c
>> @@ -830,6 +830,7 @@ int parse_events(struct perf_evlist *evlist, const char *str,
>> if (!ret) {
>> int entries = data.idx - evlist->nr_entries;
>> perf_evlist__splice_list_tail(evlist, &data.list, entries);
>> + evlist->nr_groups += data.nr_groups;
>> return 0;
>> }
>>
>> diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
>> index c356e443448d..f6b0254afe17 100644
>> --- a/tools/perf/util/parse-events.h
>> +++ b/tools/perf/util/parse-events.h
>> @@ -65,6 +65,7 @@ struct parse_events__term {
>> struct parse_events_data__events {
>> struct list_head list;
>> int idx;
>> + int nr_groups;
>> };
>>
>> struct parse_events_data__terms {
>> diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
>> index cd88209e3c58..d14bb507594b 100644
>> --- a/tools/perf/util/parse-events.y
>> +++ b/tools/perf/util/parse-events.y
>> @@ -122,7 +122,9 @@ group_def:
>> PE_NAME '{' events '}'
>> {
>> struct list_head *list = $3;
>> + struct parse_events_data__events *data = _data;
>>
>> + data->nr_groups++;
>
> perhaps if you inc nr_groups only if there's more than 1 event,
> you would not need your next patch:
> perf evlist: Add perf_evlist__recalc_nr_groups
>
> something like:
>
> if (!list_is_last(list))
> data->nr_groups++;
>
Right! Will use it in next version.
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/