Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1669576

Re: [PATCH 1/4] perf ftrace: Show error message when fails to set ftrace files

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/4] perf ftrace: Show error message when fails to set ftrace files
Date 2017-06-19 20:30 +0200
Message-ID <tU9B1-6dJ-37@gated-at.bofh.it> (permalink)
References <tTJnb-6jf-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Sun, Jun 18, 2017 at 11:22:59PM +0900, Namhyung Kim escreveu:
> It'd be better for debugging to show an error message when it fails to
> setup ftrace for some reason.

Thanks a lot, tested the series, excellent ftrace subset to support in
'perf ftrace'! :-)

- Arnaldo
 
> 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] perf ftrace: Show error message when fails to set ftrace files Namhyung Kim <namhyung@kernel.org> - 2017-06-18 16:30 +0200
  [PATCH 4/4] perf ftrace: Add -D option for depth filter Namhyung Kim <namhyung@kernel.org> - 2017-06-18 16:30 +0200
    [tip:perf/core] perf ftrace: Add -D option for depth filter tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-06-20 11:20 +0200
  [PATCH 2/4] perf ftrace: Move setup_pager before opening trace_pipe Namhyung Kim <namhyung@kernel.org> - 2017-06-18 16:30 +0200
    [tip:perf/core] perf ftrace: Move setup_pager before opening  trace_pipe tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-06-20 11:10 +0200
  Re: [PATCH 1/4] perf ftrace: Show error message when fails to set  ftrace files Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-19 20:30 +0200
  [tip:perf/core] perf ftrace: Show error message when fails to set  ftrace files tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-06-20 11:10 +0200

csiph-web