perf hists: Link hist entry pairs to leader
authorNamhyung Kim <[email protected]>
Thu, 29 Nov 2012 06:38:34 +0000 (15:38 +0900)
committerArnaldo Carvalho de Melo <[email protected]>
Sun, 9 Dec 2012 11:46:06 +0000 (08:46 -0300)
Current hists__match/link() link a leader to its pair, so if multiple
pairs were linked, the leader will lose pointer to previous pairs since
it was overwritten.  Fix it by making leader the list head.

Signed-off-by: Namhyung Kim <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/hist.c

index d2bc05cd1708cc876022fe5f5b2d4876932b17a2..82df1b26f0d490226ac8404ce0da9df92e429817 100644 (file)
@@ -785,7 +785,7 @@ void hists__match(struct hists *leader, struct hists *other)
                pair = hists__find_entry(other, pos);
 
                if (pair)
-                       hist_entry__add_pair(pos, pair);
+                       hist_entry__add_pair(pair, pos);
        }
 }
 
@@ -806,7 +806,7 @@ int hists__link(struct hists *leader, struct hists *other)
                        pair = hists__add_dummy_entry(leader, pos);
                        if (pair == NULL)
                                return -1;
-                       hist_entry__add_pair(pair, pos);
+                       hist_entry__add_pair(pos, pair);
                }
        }