Commit c2141055 authored by He Kuang's avatar He Kuang Committed by Arnaldo Carvalho de Melo

perf data: Show error message when conversion failed

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: default avatarHe Kuang <hekuang@huawei.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jeremie Galarneau <jgalar@efficios.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-xvhr1vf7zav9kkeo9w1hv4uk@git.kernel.org
Link: http://lkml.kernel.org/r/1429372220-6406-2-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a0b404f4
...@@ -837,6 +837,8 @@ int bt_convert__perf2ctf(const char *input, const char *path, bool force) ...@@ -837,6 +837,8 @@ int bt_convert__perf2ctf(const char *input, const char *path, bool force)
err = perf_session__process_events(session); err = perf_session__process_events(session);
if (!err) if (!err)
err = bt_ctf_stream_flush(cw->stream); err = bt_ctf_stream_flush(cw->stream);
else
pr_err("Error during conversion.\n");
fprintf(stderr, fprintf(stderr,
"[ perf data convert: Converted '%s' into CTF data '%s' ]\n", "[ perf data convert: Converted '%s' into CTF data '%s' ]\n",
...@@ -847,11 +849,15 @@ int bt_convert__perf2ctf(const char *input, const char *path, bool force) ...@@ -847,11 +849,15 @@ int bt_convert__perf2ctf(const char *input, const char *path, bool force)
(double) c.events_size / 1024.0 / 1024.0, (double) c.events_size / 1024.0 / 1024.0,
c.events_count); c.events_count);
/* its all good */
free_session:
perf_session__delete(session); perf_session__delete(session);
ctf_writer__cleanup(cw);
return err;
free_session:
perf_session__delete(session);
free_writer: free_writer:
ctf_writer__cleanup(cw); ctf_writer__cleanup(cw);
pr_err("Error during conversion setup.\n");
return err; return err;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment