[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160919075954.GB26906@krava>
Date: Mon, 19 Sep 2016 09:59:54 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Jiri Olsa <jolsa@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Andi Kleen <andi@...stfloor.org>
Subject: Re: [PATCH 2/7] perf hist: Introduce hists__link_hierarchy()
On Tue, Sep 13, 2016 at 04:45:47PM +0900, Namhyung Kim wrote:
> The hists__link_hierarchy() is to support hierarchy report with event
> group. When it matches leader event and other members (with the
> hists__match_hierarchy), it also needs to link unmatched member entries
> with a dummy leader event so that it can show up in the output.
SNIP
>
> +static int hists__link_hierarchy(struct hists *leader_hists,
> + struct hist_entry *parent,
> + struct rb_root *leader_root,
> + struct rb_root *other_root)
> +{
> + struct rb_node *nd;
> + struct hist_entry *pos, *leader;
> +
> + for (nd = rb_first(other_root); nd; nd = rb_next(nd)) {
> + pos = rb_entry(nd, struct hist_entry, rb_node_in);
> +
> + if (hist_entry__has_pairs(pos)) {
> + bool found = false;
> +
> + list_for_each_entry(leader, &pos->pairs.head, pairs.node) {
> + if (leader->hists == leader_hists) {
> + found = true;
> + break;
> + }
> + }
> + if (!found)
> + return -1;
> + } else {
> + leader = add_dummy_hierarchy_entry(leader_hists,
> + leader_root, pos);
could we call hists__add_dummy_entry in here? seems like there's only
difference in function arguments.. we could safe one function ;-)
thanks,
jirka
Powered by blists - more mailing lists