All of lore.kernel.org
 help / color / mirror / Atom feed
* [diamon-discuss] [BUG] perf data convert to ctf fail.
@ 2015-01-16  5:23 Wang Nan
  2015-01-16  7:55 ` Alexandre Montplaisir
  0 siblings, 1 reply; 8+ messages in thread
From: Wang Nan @ 2015-01-16  5:23 UTC (permalink / raw)
  To: Jiri Olsa, Jiri Olsa; +Cc: diamon-discuss@lists.linuxfoundation.org, Li Zefan

Hi Jiri Olsa,

We are working on your perf convert to ctf patches and trying to
convert perf.data into CTF trace. By introducing 8 patches from your
repository (the last 8 patches of branch perf/core_ctf_convert) we can
use 'perf data convert --to-ctf' command. However, it doesn't work properly:

 $ perf record ls
 $ perf data convert --to-ctf ./out.ctf
close: Bad file descriptor
Failed to create CTF stream
[ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
[ perf data convert: Converted and wrote 0.000 MB (1 samples) ]

After some debug we found that the problem raises from libbaleltrace:
in bt_ctf_writer_create_stream() --> bt_ctf_trace_create_stream(), it tries
to create a stream from stream_class, but doesn't provide a stream_id. When
bt_ctf_trace_create_stream() tries to allocate an id for it, the stream_class
has been freezed.

Could you please have a look at this problem?

Thank you!


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [diamon-discuss] [BUG] perf data convert to ctf fail.
  2015-01-16  5:23 [diamon-discuss] [BUG] perf data convert to ctf fail Wang Nan
@ 2015-01-16  7:55 ` Alexandre Montplaisir
  2015-01-16  8:14   ` Jiri Olsa
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Montplaisir @ 2015-01-16  7:55 UTC (permalink / raw)
  To: Wang Nan, Jiri Olsa, Jiri Olsa
  Cc: diamon-discuss@lists.linuxfoundation.org, Li Zefan

Hi Wang,

I can reproduce your issue, using Babeltrace commit 36336d933 (from Jan 
6th). I had it working at some point before, so there must have been 
some changes to the Babeltrace API since then.

If I update to Babeltrace master (9f476966), I then hit 
https://bugs.lttng.org/issues/874 . Fixing it manually I can get it 
building, but then the "perf data convert" command now fails with a new 
error:

perf data convert --to-ctf=./ctf
perf: event.c:292: bt_ctf_event_create: Assertion 
`event_class->stream_class->event_header_type' failed.
Aborted

I've CC'ed Mathieu and Jérémie, perhaps they can give us some pointers 
as to what should be updated in the perf patch set?

Cheers,
Alex


On 2015-01-16 12:23 AM, Wang Nan wrote:
> Hi Jiri Olsa,
>
> We are working on your perf convert to ctf patches and trying to
> convert perf.data into CTF trace. By introducing 8 patches from your
> repository (the last 8 patches of branch perf/core_ctf_convert) we can
> use 'perf data convert --to-ctf' command. However, it doesn't work properly:
>
>   $ perf record ls
>   $ perf data convert --to-ctf ./out.ctf
> close: Bad file descriptor
> Failed to create CTF stream
> [ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
> [ perf data convert: Converted and wrote 0.000 MB (1 samples) ]
>
> After some debug we found that the problem raises from libbaleltrace:
> in bt_ctf_writer_create_stream() --> bt_ctf_trace_create_stream(), it tries
> to create a stream from stream_class, but doesn't provide a stream_id. When
> bt_ctf_trace_create_stream() tries to allocate an id for it, the stream_class
> has been freezed.
>
> Could you please have a look at this problem?
>
> Thank you!
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [diamon-discuss] [BUG] perf data convert to ctf fail.
  2015-01-16  7:55 ` Alexandre Montplaisir
@ 2015-01-16  8:14   ` Jiri Olsa
  2015-01-16 10:38     ` Jiri Olsa
  0 siblings, 1 reply; 8+ messages in thread
From: Jiri Olsa @ 2015-01-16  8:14 UTC (permalink / raw)
  To: Alexandre Montplaisir
  Cc: diamon-discuss@lists.linuxfoundation.org, Li Zefan, Jiri Olsa

On Fri, Jan 16, 2015 at 02:55:01AM -0500, Alexandre Montplaisir wrote:
> Hi Wang,
> 
> I can reproduce your issue, using Babeltrace commit 36336d933 (from Jan
> 6th). I had it working at some point before, so there must have been some
> changes to the Babeltrace API since then.
> 
> If I update to Babeltrace master (9f476966), I then hit
> https://bugs.lttng.org/issues/874 . Fixing it manually I can get it
> building, but then the "perf data convert" command now fails with a new
> error:
> 
> perf data convert --to-ctf=./ctf
> perf: event.c:292: bt_ctf_event_create: Assertion
> `event_class->stream_class->event_header_type' failed.
> Aborted

hum, haven't seen this one before.. I'll check with latest babeltrace

> 
> I've CC'ed Mathieu and Jérémie, perhaps they can give us some pointers as to
> what should be updated in the perf patch set?
> 
> Cheers,
> Alex
> 
> 
> On 2015-01-16 12:23 AM, Wang Nan wrote:
> >Hi Jiri Olsa,
> >
> >We are working on your perf convert to ctf patches and trying to
> >convert perf.data into CTF trace. By introducing 8 patches from your
> >repository (the last 8 patches of branch perf/core_ctf_convert) we can
> >use 'perf data convert --to-ctf' command. However, it doesn't work properly:
> >
> >  $ perf record ls
> >  $ perf data convert --to-ctf ./out.ctf
> >close: Bad file descriptor
> >Failed to create CTF stream
> >[ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
> >[ perf data convert: Converted and wrote 0.000 MB (1 samples) ]

Any chance you're not using proper library? I'm always
lazy to properly install that and need to run perf with
LD_LIBRARY_PATH set, like:

  LD_LIBRARY_PATH=/opt/libbabeltrace/lib ./perf ....


> >
> >After some debug we found that the problem raises from libbaleltrace:
> >in bt_ctf_writer_create_stream() --> bt_ctf_trace_create_stream(), it tries
> >to create a stream from stream_class, but doesn't provide a stream_id. When
> >bt_ctf_trace_create_stream() tries to allocate an id for it, the stream_class
> >has been freezed.

probably it's some issue wrt the babeltrace changes
Alexandre mentioned.. I'll check

thanks,
jirka

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [diamon-discuss] [BUG] perf data convert to ctf fail.
  2015-01-16  8:14   ` Jiri Olsa
@ 2015-01-16 10:38     ` Jiri Olsa
  2015-01-16 10:40       ` Jiri Olsa
                         ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jiri Olsa @ 2015-01-16 10:38 UTC (permalink / raw)
  To: Alexandre Montplaisir, Jérémie Galarneau
  Cc: Li Zefan, Jiri Olsa, diamon-discuss@lists.linuxfoundation.org

On Fri, Jan 16, 2015 at 09:14:28AM +0100, Jiri Olsa wrote:
> On Fri, Jan 16, 2015 at 02:55:01AM -0500, Alexandre Montplaisir wrote:
> > Hi Wang,
> > 
> > I can reproduce your issue, using Babeltrace commit 36336d933 (from Jan
> > 6th). I had it working at some point before, so there must have been some
> > changes to the Babeltrace API since then.
> > 
> > If I update to Babeltrace master (9f476966), I then hit
> > https://bugs.lttng.org/issues/874 . Fixing it manually I can get it
> > building, but then the "perf data convert" command now fails with a new
> > error:
> > 
> > perf data convert --to-ctf=./ctf
> > perf: event.c:292: bt_ctf_event_create: Assertion
> > `event_class->stream_class->event_header_type' failed.
> > Aborted
> 
> hum, haven't seen this one before.. I'll check with latest babeltrace
> 
> > 
> > I've CC'ed Mathieu and Jérémie, perhaps they can give us some pointers as to
> > what should be updated in the perf patch set?
> > 
> > Cheers,
> > Alex
> > 
> > 
> > On 2015-01-16 12:23 AM, Wang Nan wrote:
> > >Hi Jiri Olsa,
> > >
> > >We are working on your perf convert to ctf patches and trying to
> > >convert perf.data into CTF trace. By introducing 8 patches from your
> > >repository (the last 8 patches of branch perf/core_ctf_convert) we can
> > >use 'perf data convert --to-ctf' command. However, it doesn't work properly:
> > >
> > >  $ perf record ls
> > >  $ perf data convert --to-ctf ./out.ctf
> > >close: Bad file descriptor
> > >Failed to create CTF stream
> > >[ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
> > >[ perf data convert: Converted and wrote 0.000 MB (1 samples) ]
> 

so I've got both errors in the end ;-)

looks like the babeltrace writer API got changed or
were not using it right..

I put some fixes on top of my perf/core_ctf_convert
branch and it's working for me now, but I need to
discuss the API usage

Jérémie,
my babeltrace git sources HEAD is 9f476966aa40.

I needed to do following changes/commits in perf:
(please check my git tree [1] branch perf/core_ctf_convert)

  - perf data: Define custom event_header_type
    define our own event_header_type because it's no longer
    generated by default by the library.. is it correct behaviour?

  - perf data: Disable Werror convert object
    this is probably babeltrace bug, because if I enable -Werror I'll get:

		In file included from /opt/libbabeltrace//include/babeltrace/ctf-writer/stream.h:30:0,
				 from util/data-convert-bt.c:13:
		/opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:196:12: error: redundant redeclaration of ‘bt_ctf_stream_set_event_context’ [-Werror=redundant-decls]
		 extern int bt_ctf_stream_set_event_context(
			    ^
		/opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:171:12: note: previous declaration of ‘bt_ctf_stream_set_event_context’ was here
		 extern int bt_ctf_stream_set_event_context(
			    ^

  - perf data: Init stram_class with ID
    the bt_ctf_trace_create_stream function tries to set ID on
    stream_class which gets frozen just few moments ago in
    bt_ctf_stream_create call..

    this trigers failure and close up of stream fd which is not set yet:

        if (close(stream->pos.fd)) {
                perror("close");
        }

    hence the 'close: Bad file descriptor' message
    so this one looks like a bug to me, but we might be misusing the API also..


feel free to move this discussion to babeltrace-devel list ;-)

thanks for comments,
jirka

[1] git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [diamon-discuss] [BUG] perf data convert to ctf fail.
  2015-01-16 10:38     ` Jiri Olsa
@ 2015-01-16 10:40       ` Jiri Olsa
  2015-01-16 16:18       ` Jérémie Galarneau
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Jiri Olsa @ 2015-01-16 10:40 UTC (permalink / raw)
  To: Alexandre Montplaisir, Jérémie Galarneau
  Cc: Sebastian Andrzej Siewior,
	diamon-discuss@lists.linuxfoundation.org, Li Zefan, Jiri Olsa

and adding Sebastian to the loop ;-)

jirka

On Fri, Jan 16, 2015 at 11:38:43AM +0100, Jiri Olsa wrote:
> On Fri, Jan 16, 2015 at 09:14:28AM +0100, Jiri Olsa wrote:
> > On Fri, Jan 16, 2015 at 02:55:01AM -0500, Alexandre Montplaisir wrote:
> > > Hi Wang,
> > > 
> > > I can reproduce your issue, using Babeltrace commit 36336d933 (from Jan
> > > 6th). I had it working at some point before, so there must have been some
> > > changes to the Babeltrace API since then.
> > > 
> > > If I update to Babeltrace master (9f476966), I then hit
> > > https://bugs.lttng.org/issues/874 . Fixing it manually I can get it
> > > building, but then the "perf data convert" command now fails with a new
> > > error:
> > > 
> > > perf data convert --to-ctf=./ctf
> > > perf: event.c:292: bt_ctf_event_create: Assertion
> > > `event_class->stream_class->event_header_type' failed.
> > > Aborted
> > 
> > hum, haven't seen this one before.. I'll check with latest babeltrace
> > 
> > > 
> > > I've CC'ed Mathieu and Jérémie, perhaps they can give us some pointers as to
> > > what should be updated in the perf patch set?
> > > 
> > > Cheers,
> > > Alex
> > > 
> > > 
> > > On 2015-01-16 12:23 AM, Wang Nan wrote:
> > > >Hi Jiri Olsa,
> > > >
> > > >We are working on your perf convert to ctf patches and trying to
> > > >convert perf.data into CTF trace. By introducing 8 patches from your
> > > >repository (the last 8 patches of branch perf/core_ctf_convert) we can
> > > >use 'perf data convert --to-ctf' command. However, it doesn't work properly:
> > > >
> > > >  $ perf record ls
> > > >  $ perf data convert --to-ctf ./out.ctf
> > > >close: Bad file descriptor
> > > >Failed to create CTF stream
> > > >[ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
> > > >[ perf data convert: Converted and wrote 0.000 MB (1 samples) ]
> > 
> 
> so I've got both errors in the end ;-)
> 
> looks like the babeltrace writer API got changed or
> were not using it right..
> 
> I put some fixes on top of my perf/core_ctf_convert
> branch and it's working for me now, but I need to
> discuss the API usage
> 
> Jérémie,
> my babeltrace git sources HEAD is 9f476966aa40.
> 
> I needed to do following changes/commits in perf:
> (please check my git tree [1] branch perf/core_ctf_convert)
> 
>   - perf data: Define custom event_header_type
>     define our own event_header_type because it's no longer
>     generated by default by the library.. is it correct behaviour?
> 
>   - perf data: Disable Werror convert object
>     this is probably babeltrace bug, because if I enable -Werror I'll get:
> 
> 		In file included from /opt/libbabeltrace//include/babeltrace/ctf-writer/stream.h:30:0,
> 				 from util/data-convert-bt.c:13:
> 		/opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:196:12: error: redundant redeclaration of ‘bt_ctf_stream_set_event_context’ [-Werror=redundant-decls]
> 		 extern int bt_ctf_stream_set_event_context(
> 			    ^
> 		/opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:171:12: note: previous declaration of ‘bt_ctf_stream_set_event_context’ was here
> 		 extern int bt_ctf_stream_set_event_context(
> 			    ^
> 
>   - perf data: Init stram_class with ID
>     the bt_ctf_trace_create_stream function tries to set ID on
>     stream_class which gets frozen just few moments ago in
>     bt_ctf_stream_create call..
> 
>     this trigers failure and close up of stream fd which is not set yet:
> 
>         if (close(stream->pos.fd)) {
>                 perror("close");
>         }
> 
>     hence the 'close: Bad file descriptor' message
>     so this one looks like a bug to me, but we might be misusing the API also..
> 
> 
> feel free to move this discussion to babeltrace-devel list ;-)
> 
> thanks for comments,
> jirka
> 
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [diamon-discuss] [BUG] perf data convert to ctf fail.
  2015-01-16 10:38     ` Jiri Olsa
  2015-01-16 10:40       ` Jiri Olsa
  2015-01-16 16:18       ` Jérémie Galarneau
@ 2015-01-16 16:18       ` Jérémie Galarneau
  2015-01-16 16:33       ` Jérémie Galarneau
  3 siblings, 0 replies; 8+ messages in thread
From: Jérémie Galarneau @ 2015-01-16 16:18 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: diamon-discuss@lists.linuxfoundation.org,
	lttng-dev@lists.lttng.org, Li Zefan, Jiri Olsa

On Fri, Jan 16, 2015 at 5:38 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Fri, Jan 16, 2015 at 09:14:28AM +0100, Jiri Olsa wrote:
>> On Fri, Jan 16, 2015 at 02:55:01AM -0500, Alexandre Montplaisir wrote:
>> > Hi Wang,
>> >
>> > I can reproduce your issue, using Babeltrace commit 36336d933 (from Jan
>> > 6th). I had it working at some point before, so there must have been some
>> > changes to the Babeltrace API since then.
>> >
>> > If I update to Babeltrace master (9f476966), I then hit
>> > https://bugs.lttng.org/issues/874 . Fixing it manually I can get it
>> > building, but then the "perf data convert" command now fails with a new
>> > error:
>> >
>> > perf data convert --to-ctf=./ctf
>> > perf: event.c:292: bt_ctf_event_create: Assertion
>> > `event_class->stream_class->event_header_type' failed.
>> > Aborted
>>
>> hum, haven't seen this one before.. I'll check with latest babeltrace
>>
>> >
>> > I've CC'ed Mathieu and Jérémie, perhaps they can give us some pointers as to
>> > what should be updated in the perf patch set?
>> >
>> > Cheers,
>> > Alex
>> >
>> >
>> > On 2015-01-16 12:23 AM, Wang Nan wrote:
>> > >Hi Jiri Olsa,
>> > >
>> > >We are working on your perf convert to ctf patches and trying to
>> > >convert perf.data into CTF trace. By introducing 8 patches from your
>> > >repository (the last 8 patches of branch perf/core_ctf_convert) we can
>> > >use 'perf data convert --to-ctf' command. However, it doesn't work properly:
>> > >
>> > >  $ perf record ls
>> > >  $ perf data convert --to-ctf ./out.ctf
>> > >close: Bad file descriptor
>> > >Failed to create CTF stream
>> > >[ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
>> > >[ perf data convert: Converted and wrote 0.000 MB (1 samples) ]
>>
>
> so I've got both errors in the end ;-)
>
> looks like the babeltrace writer API got changed or
> were not using it right..
>
> I put some fixes on top of my perf/core_ctf_convert
> branch and it's working for me now, but I need to
> discuss the API usage
>
> Jérémie,
> my babeltrace git sources HEAD is 9f476966aa40.
>
> I needed to do following changes/commits in perf:
> (please check my git tree [1] branch perf/core_ctf_convert)
>
>   - perf data: Define custom event_header_type
>     define our own event_header_type because it's no longer
>     generated by default by the library.. is it correct behaviour?
>
>   - perf data: Disable Werror convert object
>     this is probably babeltrace bug, because if I enable -Werror I'll get:
>
>                 In file included from /opt/libbabeltrace//include/babeltrace/ctf-writer/stream.h:30:0,
>                                  from util/data-convert-bt.c:13:
>                 /opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:196:12: error: redundant redeclaration of ‘bt_ctf_stream_set_event_context’ [-Werror=redundant-decls]
>                  extern int bt_ctf_stream_set_event_context(
>                             ^
>                 /opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:171:12: note: previous declaration of ‘bt_ctf_stream_set_event_context’ was here
>                  extern int bt_ctf_stream_set_event_context(
>                             ^
>
>   - perf data: Init stram_class with ID
>     the bt_ctf_trace_create_stream function tries to set ID on
>     stream_class which gets frozen just few moments ago in
>     bt_ctf_stream_create call..
>
>     this trigers failure and close up of stream fd which is not set yet:
>
>         if (close(stream->pos.fd)) {
>                 perror("close");
>         }
>
>     hence the 'close: Bad file descriptor' message
>     so this one looks like a bug to me, but we might be misusing the API also..
>
>
> feel free to move this discussion to babeltrace-devel list ;-)

CC-ing lttng-dev.
Thanks for the quick report! I'm on it and I'll keep you updated as
soon as I have pushed a fix.

Jérémie

>
> thanks for comments,
> jirka
>
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [diamon-discuss] [BUG] perf data convert to ctf fail.
  2015-01-16 10:38     ` Jiri Olsa
  2015-01-16 10:40       ` Jiri Olsa
@ 2015-01-16 16:18       ` Jérémie Galarneau
  2015-01-16 16:18       ` Jérémie Galarneau
  2015-01-16 16:33       ` Jérémie Galarneau
  3 siblings, 0 replies; 8+ messages in thread
From: Jérémie Galarneau @ 2015-01-16 16:18 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Wang Nan, diamon-discuss@lists.linuxfoundation.org,
	lttng-dev@lists.lttng.org, Li Zefan, Jiri Olsa

On Fri, Jan 16, 2015 at 5:38 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Fri, Jan 16, 2015 at 09:14:28AM +0100, Jiri Olsa wrote:
>> On Fri, Jan 16, 2015 at 02:55:01AM -0500, Alexandre Montplaisir wrote:
>> > Hi Wang,
>> >
>> > I can reproduce your issue, using Babeltrace commit 36336d933 (from Jan
>> > 6th). I had it working at some point before, so there must have been some
>> > changes to the Babeltrace API since then.
>> >
>> > If I update to Babeltrace master (9f476966), I then hit
>> > https://bugs.lttng.org/issues/874 . Fixing it manually I can get it
>> > building, but then the "perf data convert" command now fails with a new
>> > error:
>> >
>> > perf data convert --to-ctf=./ctf
>> > perf: event.c:292: bt_ctf_event_create: Assertion
>> > `event_class->stream_class->event_header_type' failed.
>> > Aborted
>>
>> hum, haven't seen this one before.. I'll check with latest babeltrace
>>
>> >
>> > I've CC'ed Mathieu and Jérémie, perhaps they can give us some pointers as to
>> > what should be updated in the perf patch set?
>> >
>> > Cheers,
>> > Alex
>> >
>> >
>> > On 2015-01-16 12:23 AM, Wang Nan wrote:
>> > >Hi Jiri Olsa,
>> > >
>> > >We are working on your perf convert to ctf patches and trying to
>> > >convert perf.data into CTF trace. By introducing 8 patches from your
>> > >repository (the last 8 patches of branch perf/core_ctf_convert) we can
>> > >use 'perf data convert --to-ctf' command. However, it doesn't work properly:
>> > >
>> > >  $ perf record ls
>> > >  $ perf data convert --to-ctf ./out.ctf
>> > >close: Bad file descriptor
>> > >Failed to create CTF stream
>> > >[ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
>> > >[ perf data convert: Converted and wrote 0.000 MB (1 samples) ]
>>
>
> so I've got both errors in the end ;-)
>
> looks like the babeltrace writer API got changed or
> were not using it right..
>
> I put some fixes on top of my perf/core_ctf_convert
> branch and it's working for me now, but I need to
> discuss the API usage
>
> Jérémie,
> my babeltrace git sources HEAD is 9f476966aa40.
>
> I needed to do following changes/commits in perf:
> (please check my git tree [1] branch perf/core_ctf_convert)
>
>   - perf data: Define custom event_header_type
>     define our own event_header_type because it's no longer
>     generated by default by the library.. is it correct behaviour?
>
>   - perf data: Disable Werror convert object
>     this is probably babeltrace bug, because if I enable -Werror I'll get:
>
>                 In file included from /opt/libbabeltrace//include/babeltrace/ctf-writer/stream.h:30:0,
>                                  from util/data-convert-bt.c:13:
>                 /opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:196:12: error: redundant redeclaration of ‘bt_ctf_stream_set_event_context’ [-Werror=redundant-decls]
>                  extern int bt_ctf_stream_set_event_context(
>                             ^
>                 /opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:171:12: note: previous declaration of ‘bt_ctf_stream_set_event_context’ was here
>                  extern int bt_ctf_stream_set_event_context(
>                             ^
>
>   - perf data: Init stram_class with ID
>     the bt_ctf_trace_create_stream function tries to set ID on
>     stream_class which gets frozen just few moments ago in
>     bt_ctf_stream_create call..
>
>     this trigers failure and close up of stream fd which is not set yet:
>
>         if (close(stream->pos.fd)) {
>                 perror("close");
>         }
>
>     hence the 'close: Bad file descriptor' message
>     so this one looks like a bug to me, but we might be misusing the API also..
>
>
> feel free to move this discussion to babeltrace-devel list ;-)

CC-ing lttng-dev.
Thanks for the quick report! I'm on it and I'll keep you updated as
soon as I have pushed a fix.

Jérémie

>
> thanks for comments,
> jirka
>
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [diamon-discuss] [BUG] perf data convert to ctf fail.
  2015-01-16 10:38     ` Jiri Olsa
                         ` (2 preceding siblings ...)
  2015-01-16 16:18       ` Jérémie Galarneau
@ 2015-01-16 16:33       ` Jérémie Galarneau
  3 siblings, 0 replies; 8+ messages in thread
From: Jérémie Galarneau @ 2015-01-16 16:33 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: diamon-discuss@lists.linuxfoundation.org, Li Zefan, Jiri Olsa

On Fri, Jan 16, 2015 at 5:38 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Fri, Jan 16, 2015 at 09:14:28AM +0100, Jiri Olsa wrote:
>> On Fri, Jan 16, 2015 at 02:55:01AM -0500, Alexandre Montplaisir wrote:
>> > Hi Wang,
>> >
>> > I can reproduce your issue, using Babeltrace commit 36336d933 (from Jan
>> > 6th). I had it working at some point before, so there must have been some
>> > changes to the Babeltrace API since then.
>> >
>> > If I update to Babeltrace master (9f476966), I then hit
>> > https://bugs.lttng.org/issues/874 . Fixing it manually I can get it
>> > building, but then the "perf data convert" command now fails with a new
>> > error:
>> >
>> > perf data convert --to-ctf=./ctf
>> > perf: event.c:292: bt_ctf_event_create: Assertion
>> > `event_class->stream_class->event_header_type' failed.
>> > Aborted
>>
>> hum, haven't seen this one before.. I'll check with latest babeltrace
>>
>> >
>> > I've CC'ed Mathieu and Jérémie, perhaps they can give us some pointers as to
>> > what should be updated in the perf patch set?
>> >
>> > Cheers,
>> > Alex
>> >
>> >
>> > On 2015-01-16 12:23 AM, Wang Nan wrote:
>> > >Hi Jiri Olsa,
>> > >
>> > >We are working on your perf convert to ctf patches and trying to
>> > >convert perf.data into CTF trace. By introducing 8 patches from your
>> > >repository (the last 8 patches of branch perf/core_ctf_convert) we can
>> > >use 'perf data convert --to-ctf' command. However, it doesn't work properly:
>> > >
>> > >  $ perf record ls
>> > >  $ perf data convert --to-ctf ./out.ctf
>> > >close: Bad file descriptor
>> > >Failed to create CTF stream
>> > >[ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
>> > >[ perf data convert: Converted and wrote 0.000 MB (1 samples) ]
>>
>
> so I've got both errors in the end ;-)
>
> looks like the babeltrace writer API got changed or
> were not using it right..
>
> I put some fixes on top of my perf/core_ctf_convert
> branch and it's working for me now, but I need to
> discuss the API usage
>
> Jérémie,
> my babeltrace git sources HEAD is 9f476966aa40.
>
> I needed to do following changes/commits in perf:
> (please check my git tree [1] branch perf/core_ctf_convert)
>
>   - perf data: Define custom event_header_type
>     define our own event_header_type because it's no longer
>     generated by default by the library.. is it correct behaviour?
>

The event header is now "override-able" but, by default, should still
be initialized by the library. This is definitely a bug.
You don't need to use this new API if the default event header layout
(uint32_t id; uint64_t timestamp) suited your use-case.

>   - perf data: Disable Werror convert object
>     this is probably babeltrace bug, because if I enable -Werror I'll get:
>
>                 In file included from /opt/libbabeltrace//include/babeltrace/ctf-writer/stream.h:30:0,
>                                  from util/data-convert-bt.c:13:
>                 /opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:196:12: error: redundant redeclaration of ‘bt_ctf_stream_set_event_context’ [-Werror=redundant-decls]
>                  extern int bt_ctf_stream_set_event_context(
>                             ^
>                 /opt/libbabeltrace//include/babeltrace/ctf-ir/stream.h:171:12: note: previous declaration of ‘bt_ctf_stream_set_event_context’ was here
>                  extern int bt_ctf_stream_set_event_context(
>                             ^
>
>   - perf data: Init stram_class with ID
>     the bt_ctf_trace_create_stream function tries to set ID on
>     stream_class which gets frozen just few moments ago in
>     bt_ctf_stream_create call..
>
>     this trigers failure and close up of stream fd which is not set yet:
>
>         if (close(stream->pos.fd)) {
>                 perror("close");
>         }
>
>     hence the 'close: Bad file descriptor' message
>     so this one looks like a bug to me, but we might be misusing the API also..
>

I think that was all introduced by
9f476966aa40bd0de2cd0654623ea03f8a3254eb. I'll keep you posted.

Jérémie

>
> feel free to move this discussion to babeltrace-devel list ;-)
>
> thanks for comments,
> jirka
>
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-01-16 16:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-16  5:23 [diamon-discuss] [BUG] perf data convert to ctf fail Wang Nan
2015-01-16  7:55 ` Alexandre Montplaisir
2015-01-16  8:14   ` Jiri Olsa
2015-01-16 10:38     ` Jiri Olsa
2015-01-16 10:40       ` Jiri Olsa
2015-01-16 16:18       ` Jérémie Galarneau
2015-01-16 16:18       ` Jérémie Galarneau
2015-01-16 16:33       ` Jérémie Galarneau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.