aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2018-10-31 01:30:03 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-10-31 09:10:11 -0400
commitff27a06af6ffd3f49b9e193eb68f487ad76651e1 (patch)
tree8b1eb30e925d5df0c67101723487e16166cd406a
parent76b0b801782b34b3028dcef3de36cb634e3908a8 (diff)
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>
-rw-r--r--tools/perf/builtin-top.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 8e29e0cc8626..b2838de13de0 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1134,11 +1134,6 @@ static int __cmd_top(struct perf_top *top)
1134 if (!target__none(&opts->target)) 1134 if (!target__none(&opts->target))
1135 perf_evlist__enable(top->evlist); 1135 perf_evlist__enable(top->evlist);
1136 1136
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
1142 ret = -1; 1137 ret = -1;
1143 if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui : 1138 if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
1144 display_thread), top)) { 1139 display_thread), top)) {
@@ -1156,6 +1151,11 @@ static int __cmd_top(struct perf_top *top)
1156 } 1151 }
1157 } 1152 }
1158 1153
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
1159 while (!done) { 1159 while (!done) {
1160 u64 hits = top->samples; 1160 u64 hits = top->samples;
1161 1161