perf hist: Initialize hierarchy tree explicitly
authorNamhyung Kim <namhyung@kernel.org>
Tue, 13 Sep 2016 07:45:48 +0000 (16:45 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 13 Sep 2016 19:36:46 +0000 (16:36 -0300)
The hroot_in and hroot_out are roots of hierarchy trees of hist entries.

But when a hist entry is initialized by copying existing template entry,
it sometimes has non-empty tree and copies it incorrectly.  This is a
problem especially when an event group is used since it creates dummy
entries from already-processed entries in other event members.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20160913074552.13284-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/hist.c

index 702ba3a..37a08f2 100644 (file)
@@ -417,6 +417,8 @@ static int hist_entry__init(struct hist_entry *he,
        }
        INIT_LIST_HEAD(&he->pairs.node);
        thread__get(he->thread);
+       he->hroot_in  = RB_ROOT;
+       he->hroot_out = RB_ROOT;
 
        if (!symbol_conf.report_hierarchy)
                he->leaf = true;