From: Ramkumar Ramachandra <artagnon@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Subject: [PATCH] perf tool: report user-friendly error from timechart
Date: Thu, 3 Oct 2013 14:35:46 +0530 [thread overview]
Message-ID: <1380791146-7465-1-git-send-email-artagnon@gmail.com> (raw)
Earlier, when 'timechart record' was invoked by a user without
permissions to debugfs:
$ perf timechart record
invalid or unsupported event: 'power:cpu_frequency'
Run 'perf list' for a list of valid events
usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
[... detailed usage information ...]
This is highly user unfriendly, as the real problem is not reported to
the user correctly. Now, the user gets a much more friendly:
$ perf timechart record
Error: No permissions to read $debugfs/tracing/events/power/cpu_frequency
Hint: Change the permissions of debugfs: /sys/kernel/debug
The directory will be present if your kernel was compiled with debugfs support.
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
tools/perf/builtin-timechart.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index c2e0231..ceaf9b8 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -1056,6 +1056,14 @@ static int __cmd_record(int argc, const char **argv)
}
#endif
+ /* Perform a quick sanity check */
+ if (!is_valid_tracepoint("power:cpu_frequency")) {
+ fprintf(stderr, "Error:\tNo permissions to read $debugfs/tracing/events/power/cpu_frequency\n");
+ fprintf(stderr, "Hint:\tChange the permissions of debugfs: /sys/kernel/debug\n");
+ fprintf(stderr, "\tThe directory will be present if your kernel was compiled with debugfs support.\n");
+ return 1;
+ }
+
rec_argc = record_elems + argc - 1;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
--
1.8.4.477.g5d89aa9
next reply other threads:[~2013-10-03 9:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-03 9:05 Ramkumar Ramachandra [this message]
2013-10-03 12:38 ` Ingo Molnar
2013-10-03 12:43 ` Ramkumar Ramachandra
2013-10-03 13:09 ` Ingo Molnar
2013-10-03 13:35 ` David Ahern
2013-10-03 17:08 ` Arnaldo Carvalho de Melo
2013-10-03 17:22 ` David Ahern
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=1380791146-7465-1-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
/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
all inboxes | Powered by JetHome®