Skip to content

Commit ff27a06

Browse files
davem330acmel
authored andcommitted
perf top: Start display thread earlier
If events are coming in at a rate such that the event processing thread can barely keep up, our initial run of the event ring will almost never terminate and this delays the starting of the display thread. The screen basically stays black until the event thread can get out of it's endless loop. Therefore, start the display thread before we start processing the ring buffer. This also make sure that we always have the user requested real time setting engaged when processing the ring. Signed-off-by: David S. Miller <davem@davemloft.net> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20181030.223003.2242527041807905962.davem@davemloft.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 76b0b80 commit ff27a06

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/perf/builtin-top.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,11 +1134,6 @@ static int __cmd_top(struct perf_top *top)
11341134
if (!target__none(&opts->target))
11351135
perf_evlist__enable(top->evlist);
11361136

1137-
/* Wait for a minimal set of events before starting the snapshot */
1138-
perf_evlist__poll(top->evlist, 100);
1139-
1140-
perf_top__mmap_read(top);
1141-
11421137
ret = -1;
11431138
if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
11441139
display_thread), top)) {
@@ -1156,6 +1151,11 @@ static int __cmd_top(struct perf_top *top)
11561151
}
11571152
}
11581153

1154+
/* Wait for a minimal set of events before starting the snapshot */
1155+
perf_evlist__poll(top->evlist, 100);
1156+
1157+
perf_top__mmap_read(top);
1158+
11591159
while (!done) {
11601160
u64 hits = top->samples;
11611161

0 commit comments

Comments
 (0)