All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] perf ftrace: Show error message when fails to set ftrace files
@ 2017-06-18 14:22 Namhyung Kim
  2017-06-18 14:23 ` [PATCH 2/4] perf ftrace: Move setup_pager before opening trace_pipe Namhyung Kim
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Namhyung Kim @ 2017-06-18 14:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, kernel-team,
	Masami Hiramatsu, Steven Rostedt, Frederic Weisbecker

It'd be better for debugging to show an error message when it fails to
setup ftrace for some reason.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-ftrace.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 9e0b35cd0eea..966a94fa8200 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -61,6 +61,7 @@ static int __write_tracing_file(const char *name, const char *val, bool append)
 	int fd, ret = -1;
 	ssize_t size = strlen(val);
 	int flags = O_WRONLY;
+	char errbuf[512];
 
 	file = get_tracing_file(name);
 	if (!file) {
@@ -75,14 +76,16 @@ static int __write_tracing_file(const char *name, const char *val, bool append)
 
 	fd = open(file, flags);
 	if (fd < 0) {
-		pr_debug("cannot open tracing file: %s\n", name);
+		pr_debug("cannot open tracing file: %s: %s\n",
+			 name, str_error_r(errno, errbuf, sizeof(errbuf)));
 		goto out;
 	}
 
 	if (write(fd, val, size) == size)
 		ret = 0;
 	else
-		pr_debug("write '%s' to tracing/%s failed\n", val, name);
+		pr_debug("write '%s' to tracing/%s failed: %s\n",
+			 val, name, str_error_r(errno, errbuf, sizeof(errbuf)));
 
 	close(fd);
 out:
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-06-20  9:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-18 14:22 [PATCH 1/4] perf ftrace: Show error message when fails to set ftrace files Namhyung Kim
2017-06-18 14:23 ` [PATCH 2/4] perf ftrace: Move setup_pager before opening trace_pipe Namhyung Kim
2017-06-20  9:05   ` [tip:perf/core] " tip-bot for Namhyung Kim
2017-06-18 14:23 ` [PATCH 3/4] perf ftrace: Add option for function filtering Namhyung Kim
2017-06-20  9:06   ` [tip:perf/core] " tip-bot for Namhyung Kim
2017-06-18 14:23 ` [PATCH 4/4] perf ftrace: Add -D option for depth filter Namhyung Kim
2017-06-20  9:07   ` [tip:perf/core] " tip-bot for Namhyung Kim
2017-06-19 18:24 ` [PATCH 1/4] perf ftrace: Show error message when fails to set ftrace files Arnaldo Carvalho de Melo
2017-06-20  9:05 ` [tip:perf/core] " tip-bot for Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.