aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2017-06-18 10:22:59 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-06-19 21:05:51 -0400
commite7bd9ba20a9ec7024a0566a93c22b9571a48939a (patch)
treef8ebfa384d6525c69bf588b9ca41098f13e2eecc /tools/perf
parent106dacd86f042968e0bb974490fcb9cd017cd03a (diff)
perf ftrace: Show error message when fails to set ftrace files
It'd be better for debugging to show an error message when it fails to setup ftrace for some reason. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: kernel-team@lge.com Link: http://lkml.kernel.org/r/20170618142302.25390-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-ftrace.c7
1 files 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)
61 int fd, ret = -1; 61 int fd, ret = -1;
62 ssize_t size = strlen(val); 62 ssize_t size = strlen(val);
63 int flags = O_WRONLY; 63 int flags = O_WRONLY;
64 char errbuf[512];
64 65
65 file = get_tracing_file(name); 66 file = get_tracing_file(name);
66 if (!file) { 67 if (!file) {
@@ -75,14 +76,16 @@ static int __write_tracing_file(const char *name, const char *val, bool append)
75 76
76 fd = open(file, flags); 77 fd = open(file, flags);
77 if (fd < 0) { 78 if (fd < 0) {
78 pr_debug("cannot open tracing file: %s\n", name); 79 pr_debug("cannot open tracing file: %s: %s\n",
80 name, str_error_r(errno, errbuf, sizeof(errbuf)));
79 goto out; 81 goto out;
80 } 82 }
81 83
82 if (write(fd, val, size) == size) 84 if (write(fd, val, size) == size)
83 ret = 0; 85 ret = 0;
84 else 86 else
85 pr_debug("write '%s' to tracing/%s failed\n", val, name); 87 pr_debug("write '%s' to tracing/%s failed: %s\n",
88 val, name, str_error_r(errno, errbuf, sizeof(errbuf)));
86 89
87 close(fd); 90 close(fd);
88out: 91out: