[tip:perf/core] perf top: Set the 'session_done' volatile variable when exiting
From: tip-bot for Jiri Olsa
Date: Tue Dec 18 2018 - 09:17:15 EST
Commit-ID: c94cef4beb66d3e1f4ed0f3bf6c2663a9c3cf3c0
Gitweb: https://git.kernel.org/tip/c94cef4beb66d3e1f4ed0f3bf6c2663a9c3cf3c0
Author: Jiri Olsa <jolsa@xxxxxxxxxx>
AuthorDate: Wed, 7 Nov 2018 20:11:19 +0100
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Mon, 17 Dec 2018 14:58:19 -0300
perf top: Set the 'session_done' volatile variable when exiting
So we can get out of hist processing ASAP on user request.
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Acked-by: David S. Miller <davem@xxxxxxxxxxxxx>
Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Link: https://lkml.kernel.org/n/tip-r8aufbgbixr2f85s3wcoaw9v@xxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/builtin-top.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index aad58643102e..50ec01eb7f57 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -577,6 +577,12 @@ static void perf_top__sort_new_samples(void *arg)
perf_top__reset_sample_counters(t);
}
+static void stop_top(void)
+{
+ session_done = 1;
+ done = 1;
+}
+
static void *display_thread_tui(void *arg)
{
struct perf_evsel *pos;
@@ -613,13 +619,13 @@ static void *display_thread_tui(void *arg)
!top->record_opts.overwrite,
&top->annotation_opts);
- done = 1;
+ stop_top();
return NULL;
}
static void display_sig(int sig __maybe_unused)
{
- done = 1;
+ stop_top();
}
static void display_setup_sig(void)
@@ -672,7 +678,7 @@ repeat:
if (perf_top__handle_keypress(top, c))
goto repeat;
- done = 1;
+ stop_top();
}
}