mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: He Kuang <hekuang@huawei.com>
Cc: bigeasy@linutronix.de, jolsa@kernel.org, acme@kernel.org,
	a.p.zijlstra@chello.nl, mingo@redhat.com, wangnan0@huawei.com,
	linux-kernel@vger.kernel.org,
	"Jérémie Galarneau" <jeremie.galarneau@efficios.com>
Subject: Re: [PATCH 2/2] perf data: Fix ctf_writer setupenv failure
Date: Wed, 8 Apr 2015 19:59:47 +0200	[thread overview]
Message-ID: <20150408175947.GB20250@krava.redhat.com> (raw)
In-Reply-To: <1428468560-27401-2-git-send-email-hekuang@huawei.com>

On Wed, Apr 08, 2015 at 12:49:20PM +0800, He Kuang wrote:
> Due to babeltrace commit:
>   7f800dc7c2a1 ("ir: make trace environment use bt_object")
> 
> The trace->frozen flag is set in bt_ctf_trace_create_stream(), this flag
> is checked before adding environment field to trace, and causes
> ctf_writer__setup_env() failed. Fix this by setting all environment
> fields before bt_ctf_trace_create_stream().
> 
> Before this patch:
>   $ perf data convert --to-ctf=ctf
>   Error during CTF convert setup.

have you tested with the latest babeltrace sources?
this reminds me the bug they fixed recently, CCing Jeremie

thanks,
jirka

> 
> After this patch:
>   $ perf data convert --to-ctf=ctf
>   [ perf data convert: Converted 'perf.data' into CTF data 'ctf' ]
>   [ perf data convert: Converted and wrote 0.023 MB (596 samples) ]
> 
> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
>  tools/perf/util/data-convert-bt.c | 30 ++++++++++++++++++++----------
>  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
> index a5b89b9..718dc8a 100644
> --- a/tools/perf/util/data-convert-bt.c
> +++ b/tools/perf/util/data-convert-bt.c
> @@ -604,6 +604,22 @@ static int setup_events(struct ctf_writer *cw, struct perf_session *session)
>  	return 0;
>  }
>  
> +static int ctf_writer__setup_stream(struct ctf_writer *cw)
> +{
> +	struct bt_ctf_stream		*stream;
> +
> +	/* CTF stream instance */
> +	stream = bt_ctf_writer_create_stream(cw->writer, cw->stream_class);
> +	if (!stream) {
> +		pr("Failed to create CTF stream.\n");
> +		return -1;
> +	}
> +
> +	cw->stream = stream;
> +
> +	return 0;
> +}
> +
>  static int ctf_writer__setup_env(struct ctf_writer *cw,
>  				 struct perf_session *session)
>  {
> @@ -725,7 +741,6 @@ static int ctf_writer__init(struct ctf_writer *cw, const char *path)
>  {
>  	struct bt_ctf_writer		*writer;
>  	struct bt_ctf_stream_class	*stream_class;
> -	struct bt_ctf_stream		*stream;
>  	struct bt_ctf_clock		*clock;
>  
>  	/* CTF writer */
> @@ -767,15 +782,6 @@ static int ctf_writer__init(struct ctf_writer *cw, const char *path)
>  	if (ctf_writer__init_data(cw))
>  		goto err_cleanup;
>  
> -	/* CTF stream instance */
> -	stream = bt_ctf_writer_create_stream(writer, stream_class);
> -	if (!stream) {
> -		pr("Failed to create CTF stream.\n");
> -		goto err_cleanup;
> -	}
> -
> -	cw->stream = stream;
> -
>  	/* CTF clock writer setup */
>  	if (bt_ctf_writer_add_clock(writer, clock)) {
>  		pr("Failed to assign CTF clock to writer.\n");
> @@ -830,6 +836,10 @@ int bt_convert__perf2ctf(const char *input, const char *path, bool force)
>  	if (ctf_writer__setup_env(cw, session))
>  		goto free_session;
>  
> +	/* CTF writer trace stream setup */
> +	if (ctf_writer__setup_stream(cw))
> +		goto free_session;
> +
>  	/* CTF events setup */
>  	if (setup_events(cw, session))
>  		goto free_session;
> -- 
> 2.3.3.220.g9ab698f
> 

  reply	other threads:[~2015-04-08 18:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08  4:49 [PATCH 1/2] perf data: Show error message when ctf setup failed He Kuang
2015-04-08  4:49 ` [PATCH 2/2] perf data: Fix ctf_writer setupenv failure He Kuang
2015-04-08 17:59   ` Jiri Olsa [this message]
2015-04-09  7:38     ` He Kuang
2015-04-09 19:57       ` Jérémie Galarneau
2015-04-10  7:39         ` He Kuang
2015-04-10 12:38           ` Jiri Olsa
2015-04-08 17:45 ` [PATCH 1/2] perf data: Show error message when ctf setup failed Jiri Olsa
2015-04-09  7:56   ` [PATCHv2 1/2] perf data: Show error message when conversion failed He Kuang
2015-04-09  9:45     ` Jiri Olsa
2015-04-18 14:00       ` Jiri Olsa
2015-04-09  8:19   ` [PATCH 1/2] perf data: Show error message when ctf setup failed He Kuang
2015-04-09  9:46     ` Jiri Olsa
2015-04-09 14:37       ` Alexandre Montplaisir
2015-04-10 12:05         ` Jiri Olsa
2015-04-10 12:37           ` Jiri Olsa
2015-04-13 20:30             ` Jérémie Galarneau
2015-04-14 17:47               ` Jérémie Galarneau
2015-04-18 13:58                 ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150408175947.GB20250@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=hekuang@huawei.com \
    --cc=jeremie.galarneau@efficios.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®