Hi Jiri,

On Mon, Sep 19, 2016 at 4:48 PM, Jiri Olsa <jo...@redhat.com> wrote:
> 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?

Nope.  The hist_entry__collapse() traverses the whole sort list of the
event (hists->hpp_list) while this function only traverses its own
sort list (he->hpp_list).  These are different when hierarchy is used.

Thanks,
Namhyung

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



-- 
Thanks,
Namhyung

Reply via email to