linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] perf: Start 'top' display thread earlier.
@ 2018-10-31  5:30 David Miller
  2018-10-31 22:11 ` [tip:perf/urgent] perf top: Start " tip-bot for David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: David Miller @ 2018-10-31  5:30 UTC (permalink / raw)
  To: acme; +Cc: linux-kernel


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>

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index d21d875..e7a78ce 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1134,11 +1125,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)) {
@@ -1156,6 +1142,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;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:perf/urgent] perf top: Start display thread earlier
  2018-10-31  5:30 [PATCH RFC] perf: Start 'top' display thread earlier David Miller
@ 2018-10-31 22:11 ` tip-bot for David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for David Miller @ 2018-10-31 22:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: davem, mingo, linux-kernel, tglx, namhyung, acme, hpa, kan.liang, jolsa

Commit-ID:  ff27a06af6ffd3f49b9e193eb68f487ad76651e1
Gitweb:     https://git.kernel.org/tip/ff27a06af6ffd3f49b9e193eb68f487ad76651e1
Author:     David Miller <davem@davemloft.net>
AuthorDate: Tue, 30 Oct 2018 22:30:03 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 31 Oct 2018 10:10:11 -0300

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>
---
 tools/perf/builtin-top.c | 10 +++++-----
 1 file 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)
         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)) {
@@ -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;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-31 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31  5:30 [PATCH RFC] perf: Start 'top' display thread earlier David Miller
2018-10-31 22:11 ` [tip:perf/urgent] perf top: Start " tip-bot for David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).