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

From: Jiri Olsa
Date: Thu May 15 2014 - 07:43:49 EST


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 ?

jirka
--
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/