[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <158894310346.8414.8485365390466335042.tip-bot2@tip-bot2>
Date: Fri, 08 May 2020 13:05:03 -0000
From: "tip-bot2 for Arnaldo Carvalho de Melo" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Jiri Olsa <jolsa@...hat.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Namhyung Kim <namhyung@...nel.org>,
Song Liu <songliubraving@...com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
x86 <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: [tip: perf/core] perf record: Move side band evlist setup to separate routine
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 23cbb41c939a09a4b51eabacdb1f68af210c084d
Gitweb: https://git.kernel.org/tip/23cbb41c939a09a4b51eabacdb1f68af210c084d
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Tue, 28 Apr 2020 14:58:29 -03:00
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitterDate: Tue, 05 May 2020 16:35:29 -03:00
perf record: Move side band evlist setup to separate routine
It is quite big by now, move that code to a separate
record__setup_sb_evlist() routine.
Suggested-by: Jiri Olsa <jolsa@...hat.com>
Acked-by: Jiri Olsa <jolsa@...hat.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Song Liu <songliubraving@...com>
Link: http://lore.kernel.org/lkml/20200429131106.27974-9-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/builtin-record.c | 71 ++++++++++++++++++++----------------
1 file changed, 41 insertions(+), 30 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index bb5b4d2..cfb9a69 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1446,6 +1446,44 @@ static int record__process_signal_event(union perf_event *event __maybe_unused,
return 0;
}
+static int record__setup_sb_evlist(struct record *rec)
+{
+ struct record_opts *opts = &rec->opts;
+
+ if (rec->sb_evlist != NULL) {
+ /*
+ * We get here if --switch-output-event populated the
+ * sb_evlist, so associate a callback that will send a SIGUSR2
+ * to the main thread.
+ */
+ evlist__set_cb(rec->sb_evlist, record__process_signal_event, rec);
+ rec->thread_id = pthread_self();
+ }
+
+ if (!opts->no_bpf_event) {
+ if (rec->sb_evlist == NULL) {
+ rec->sb_evlist = evlist__new();
+
+ if (rec->sb_evlist == NULL) {
+ pr_err("Couldn't create side band evlist.\n.");
+ return -1;
+ }
+ }
+
+ if (evlist__add_bpf_sb_event(rec->sb_evlist, &rec->session->header.env)) {
+ pr_err("Couldn't ask for PERF_RECORD_BPF_EVENT side band events.\n.");
+ return -1;
+ }
+ }
+
+ if (perf_evlist__start_sb_thread(rec->sb_evlist, &rec->opts.target)) {
+ pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");
+ opts->no_bpf_event = true;
+ }
+
+ return 0;
+}
+
static int __cmd_record(struct record *rec, int argc, const char **argv)
{
int err;
@@ -1590,36 +1628,9 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
goto out_child;
}
- if (rec->sb_evlist != NULL) {
- /*
- * We get here if --switch-output-event populated the
- * sb_evlist, so associate a callback that will send a SIGUSR2
- * to the main thread.
- */
- evlist__set_cb(rec->sb_evlist, record__process_signal_event, rec);
- rec->thread_id = pthread_self();
- }
-
- if (!opts->no_bpf_event) {
- if (rec->sb_evlist == NULL) {
- rec->sb_evlist = evlist__new();
-
- if (rec->sb_evlist == NULL) {
- pr_err("Couldn't create side band evlist.\n.");
- goto out_child;
- }
- }
-
- if (evlist__add_bpf_sb_event(rec->sb_evlist, &session->header.env)) {
- pr_err("Couldn't ask for PERF_RECORD_BPF_EVENT side band events.\n.");
- goto out_child;
- }
- }
-
- if (perf_evlist__start_sb_thread(rec->sb_evlist, &rec->opts.target)) {
- pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");
- opts->no_bpf_event = true;
- }
+ err = record__setup_sb_evlist(rec);
+ if (err)
+ goto out_child;
err = record__synthesize(rec, false);
if (err < 0)
Powered by blists - more mailing lists