Re: [PATCH 1/7] perf hist: Introduce hists__match_hierarchy()

From: Jiri Olsa
Date: Mon Sep 19 2016 - 03:48:39 EST


On Tue, Sep 13, 2016 at 04:45:46PM +0900, Namhyung Kim wrote:

SNIP

> +static struct hist_entry *hists__find_hierarchy_entry(struct rb_root *root,
> + struct hist_entry *he)
> +{
> + struct rb_node *n = root->rb_node;
> +
> + while (n) {
> + struct hist_entry *iter;
> + struct perf_hpp_fmt *fmt;
> + int64_t cmp = 0;
> +
> + iter = rb_entry(n, struct hist_entry, rb_node_in);
> + perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) {
> + cmp = fmt->collapse(fmt, iter, he);
> + if (cmp)
> + break;
> + }

could you call hist_entry__collapse in here instead of above code?

thanks,
jirka

> +
> + if (cmp < 0)
> + n = n->rb_left;
> + else if (cmp > 0)
> + n = n->rb_right;
> + else
> + return iter;
> + }
> +
> + return NULL;
> +}
> +