From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Clark Williams <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Ian Rogers <irogers@google.com>
Subject: [PATCH 2/2] perf record: Improve 'Workload failed' message printing events + what was exec'ed
Date: Wed, 14 Apr 2021 10:16:28 -0300 [thread overview]
Message-ID: <20210414131628.2064862-3-acme@kernel.org> (raw)
In-Reply-To: <20210414131628.2064862-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Before:
# perf record -a cycles,instructions,cache-misses
Workload failed: No such file or directory
#
After:
# perf record -a cycles,instructions,cache-misses
Failed to collect 'cycles' for the 'cycles,instructions,cache-misses' workload: No such file or directory
#
Helps disambiguating other error scenarios:
# perf record -a -e cycles,instructions,cache-misses bla
Failed to collect 'cycles,instructions,cache-misses' for the 'bla' workload: No such file or directory
# perf record -a cycles,instructions,cache-misses sleep 1
Failed to collect 'cycles' for the 'cycles,instructions,cache-misses' workload: No such file or directory
#
When all goes well we're back to the usual:
# perf record -a -e cycles,instructions,cache-misses sleep 1
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 3.151 MB perf.data (21242 samples) ]
#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-record.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 35465d1db6dda3ae..5fb9665a2ec27dde 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1977,9 +1977,13 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
record__auxtrace_snapshot_exit(rec);
if (forks && workload_exec_errno) {
- char msg[STRERR_BUFSIZE];
+ char msg[STRERR_BUFSIZE], strevsels[2048];
const char *emsg = str_error_r(workload_exec_errno, msg, sizeof(msg));
- pr_err("Workload failed: %s\n", emsg);
+
+ evlist__scnprintf_evsels(rec->evlist, sizeof(strevsels), strevsels);
+
+ pr_err("Failed to collect '%s' for the '%s' workload: %s\n",
+ strevsels, argv[0], emsg);
err = -1;
goto out_child;
}
--
2.26.2
next prev parent reply other threads:[~2021-04-14 13:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-14 13:16 [RFC] Improve workload error in 'perf record' Arnaldo Carvalho de Melo
2021-04-14 13:16 ` [PATCH 1/2] perf evlist: Add a method to return the list of evsels as a string Arnaldo Carvalho de Melo
2021-04-14 13:16 ` Arnaldo Carvalho de Melo [this message]
2021-04-15 5:33 ` [RFC] Improve workload error in 'perf record' Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210414131628.2064862-3-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).