Skip to content

Commit

Permalink
perf top: Start display thread earlier
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Namhyung Kim <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
davem330 authored and acmel committed Oct 31, 2018
1 parent 76b0b80 commit ff27a06
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,6 @@ static int __cmd_top(struct perf_top *top)
if (!target__none(&opts->target))
perf_evlist__enable(top->evlist);

/* Wait for a minimal set of events before starting the snapshot */
perf_evlist__poll(top->evlist, 100);

perf_top__mmap_read(top);

ret = -1;
if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
display_thread), top)) {
Expand All @@ -1156,6 +1151,11 @@ static int __cmd_top(struct perf_top *top)
}
}

/* Wait for a minimal set of events before starting the snapshot */
perf_evlist__poll(top->evlist, 100);

perf_top__mmap_read(top);

while (!done) {
u64 hits = top->samples;

Expand Down

0 comments on commit ff27a06

Please sign in to comment.