lkml.org 
[lkml]   [2015]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv2 1/2] perf data: Show error message when conversion failed
On Thu, Apr 09, 2015 at 03:56:00PM +0800, He Kuang wrote:
> Show message when errors occurred during conversion setup and conversion
> process.
>
> Before this patch:
> $ ./perf data convert --to-ctf=ctf
> $ echo $?
> 255
>
> After this patch:
> $ ./perf data convert --to-ctf=ctf
> Error during conversion setup.
>
> Signed-off-by: He Kuang <hekuang@huawei.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> ---
> tools/perf/util/data-convert-bt.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
> index 7a12047..de80ded 100644
> --- a/tools/perf/util/data-convert-bt.c
> +++ b/tools/perf/util/data-convert-bt.c
> @@ -896,6 +896,8 @@ int bt_convert__perf2ctf(const char *input, const char *path, bool force)
> err = perf_session__process_events(session);
> if (!err)
> err = bt_ctf_stream_flush(cw->stream);
> + else
> + pr_err("Error during conversion.\n");
>
> fprintf(stderr,
> "[ perf data convert: Converted '%s' into CTF data '%s' ]\n",
> @@ -906,11 +908,15 @@ int bt_convert__perf2ctf(const char *input, const char *path, bool force)
> (double) c.events_size / 1024.0 / 1024.0,
> c.events_count);
>
> - /* its all good */
> -free_session:
> perf_session__delete(session);
> + ctf_writer__cleanup(cw);
>
> + return err;
> +
> +free_session:
> + perf_session__delete(session);
> free_writer:
> ctf_writer__cleanup(cw);
> + pr_err("Error during conversion setup.\n");
> return err;
> }
> --
> 2.3.3.220.g9ab698f
>


\
 
 \ /
  Last update: 2015-04-09 12:21    [W:0.153 / U:0.932 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site