[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <331e87d881040594673af3399a8b925442fa46d2.1629454773.git.rickyman7@gmail.com>
Date: Fri, 20 Aug 2021 12:53:59 +0200
From: Riccardo Mancini <rickyman7@...il.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Ian Rogers <irogers@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org,
Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>,
Riccardo Mancini <rickyman7@...il.com>
Subject: [RFC PATCH v3 13/15] perf top: setup global workqueue
This patch initializes the global workqueue in perf-top if
nr_threads_synthesize is set.
This patch is a preparation for using the global_workqueue in
synthesize.
Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
---
tools/perf/builtin-top.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a3ae9176a83e2453..9b4f220920780a95 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -49,6 +49,7 @@
#include "util/term.h"
#include "util/intlist.h"
#include "util/parse-branch-options.h"
+#include "util/workqueue/workqueue.h"
#include "arch/common.h"
#include "ui/ui.h"
@@ -1767,8 +1768,23 @@ int cmd_top(int argc, const char **argv)
opts->no_bpf_event = true;
}
+ if (top.nr_threads_synthesize == UINT_MAX)
+ top.nr_threads_synthesize = sysconf(_SC_NPROCESSORS_ONLN);
+ if (top.nr_threads_synthesize > 1) {
+ status = setup_global_workqueue(top.nr_threads_synthesize);
+ if (status) {
+ create_workqueue_strerror(global_wq, errbuf, sizeof(errbuf));
+ pr_err("setup_global_workqueue: %s\n", errbuf);
+ goto out_stop_sb_th;
+ }
+ }
+
status = __cmd_top(&top);
+ if (top.nr_threads_synthesize > 1)
+ teardown_global_workqueue();
+
+out_stop_sb_th:
if (!opts->no_bpf_event)
evlist__stop_sb_thread(top.sb_evlist);
--
2.31.1
Powered by blists - more mailing lists