Re: [PATCH 04/20] perf tools: Support event grouping in hpp ->sort()

From: Namhyung Kim
Date: Fri May 16 2014 - 02:19:34 EST


Hi Jiri,

On Thu, 15 May 2014 13:43:15 +0200, Jiri Olsa wrote:
> On Mon, May 12, 2014 at 03:28:37PM +0900, Namhyung Kim wrote:
>
> SNIP
>
>> +static int __hpp__sort(struct hist_entry *a, struct hist_entry *b,
>> + hpp_field_fn get_field)
>> +{
>> + s64 ret;
>> + int i, nr_members;
>> + struct perf_evsel *evsel;
>> + struct hist_entry *pair;
>> + u64 *fields_a, *fields_b;
>> +
>> + ret = field_cmp(get_field(a), get_field(b));
>> + if (ret || !symbol_conf.event_group)
>> + return ret;
>> +
>> + evsel = hists_to_evsel(a->hists);
>> + if (!perf_evsel__is_group_event(evsel))
>> + return ret;
>> +
>> + nr_members = evsel->nr_members;
>> + fields_a = calloc(sizeof(*fields_a), nr_members);
>> + fields_b = calloc(sizeof(*fields_b), nr_members);
>> +
>> + if (!fields_a || !fields_b)
>> + goto out;
>> +
>> + list_for_each_entry(pair, &a->pairs.head, pairs.node) {
>> + evsel = hists_to_evsel(pair->hists);
>> + fields_a[perf_evsel__group_idx(evsel)] = get_field(pair);
>> + }
>> +
>> + list_for_each_entry(pair, &b->pairs.head, pairs.node) {
>> + evsel = hists_to_evsel(pair->hists);
>> + fields_b[perf_evsel__group_idx(evsel)] = get_field(pair);
>> + }
>> +
>> + for (i = 1; i < nr_members; i++) {
>> + ret = fields_a[i] - fields_b[i];
>
> should we call here ^^^call field_cmp ?

Right! Will fix.

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/