Return-Path: Date: Fri, 16 Jan 2015 11:40:58 +0100 From: Jiri Olsa Message-ID: <20150116104057.GC22505@krava.brq.redhat.com> References: <54B8A03D.3050508@huawei.com> <54B8C3D5.9010809@voxpopuli.im> <20150116081428.GA22505@krava.brq.redhat.com> <20150116103843.GB22505@krava.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150116103843.GB22505@krava.brq.redhat.com> Subject: Re: [diamon-discuss] [BUG] perf data convert to ctf fail. List-Id: DiaMon diagnostic and monitoring workgroup general discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexandre Montplaisir , =?iso-8859-1?Q?J=E9r=E9mie?= 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