aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2019-08-28 08:15:55 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-08-28 18:15:03 -0300
commitbe5863b7d9281bbb932542d16b7d758357fde267 (patch)
tree5309194db8fc7a44fac545fc82b65b3bbe004e71 /tools/perf/builtin-top.c
parentperf top: Decay all events in the evlist (diff)
downloadlinux-dev-be5863b7d9281bbb932542d16b7d758357fde267.tar.xz
linux-dev-be5863b7d9281bbb932542d16b7d758357fde267.zip
perf top: Fix event group with more than two events
The event group feature links relevant hist entries among events so that they can be displayed together. During the link process, each hist entry in non-leader events is connected to a hist entry in the leader event. This is done in order of events specified in the command line so it assumes that events are linked in the order. But 'perf top' can break the assumption since it does the link process multiple times. For example, a hist entry can be in the third event only at first so it's linked after the leader. Some time later, second event has a hist entry for it and it'll be linked after the entry of the third event. This makes the code compilicated to deal with such unordered entries. This patch simply unlink all the entries after it's printed so that they can assume the correct order after the repeated link process. Also it'd be easy to deal with decaying old entries IMHO. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/20190827231555.121411-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 104dbb1095c5..c3f95440e99c 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -273,6 +273,12 @@ static void perf_top__resort_hists(struct perf_top *t)
evlist__for_each_entry(evlist, pos) {
struct hists *hists = evsel__hists(pos);
+ /*
+ * unlink existing entries so that they can be linked
+ * in a correct order in hists__match() below.
+ */
+ hists__unlink(hists);
+
if (evlist->enabled) {
if (t->zero) {
hists__delete_entries(hists);