[lttng-dev] [diamon-discuss] [BUG] perf data convert to ctf fail.

Jérémie Galarneau jeremie.galarneau at efficios.com
Fri Jan 16 11:18:16 EST 2015


On Fri, Jan 16, 2015 at 5:38 AM, Jiri Olsa <jolsa at 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



More information about the lttng-dev mailing list