Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754897AbbDMUbL (ORCPT ); Mon, 13 Apr 2015 16:31:11 -0400 Received: from mail-qk0-f173.google.com ([209.85.220.173]:32806 "EHLO mail-qk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754671AbbDMUbI convert rfc822-to-8bit (ORCPT ); Mon, 13 Apr 2015 16:31:08 -0400 MIME-Version: 1.0 In-Reply-To: <20150410123743.GD31326@krava.brq.redhat.com> References: <1428468560-27401-1-git-send-email-hekuang@huawei.com> <20150408174510.GA20250@krava.redhat.com> <55263608.2070301@huawei.com> <20150409094654.GA1321@krava.brq.redhat.com> <55268EBB.3020807@voxpopuli.im> <20150410120545.GC31326@krava.brq.redhat.com> <20150410123743.GD31326@krava.brq.redhat.com> Date: Mon, 13 Apr 2015 16:30:59 -0400 X-Google-Sender-Auth: J0vNc44l2TcJd2qXKC5lG62AOkA Message-ID: Subject: Re: [PATCH 1/2] perf data: Show error message when ctf setup failed From: =?UTF-8?Q?J=C3=A9r=C3=A9mie_Galarneau?= To: Jiri Olsa Cc: Alexandre Montplaisir , He Kuang , Sebastian Andrzej Siewior , Jiri Olsa , acme@kernel.org, a.p.zijlstra@chello.nl, mingo@redhat.com, Wang Nan , linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3911 Lines: 109 On Fri, Apr 10, 2015 at 8:37 AM, Jiri Olsa wrote: > On Fri, Apr 10, 2015 at 02:05:45PM +0200, Jiri Olsa wrote: > > SNIP > >> > >>I tested by using babeltrace binary and it works. >> > >> >> > >>After receiving your reply, I test on the latest tracecompass. A >> > >>folder named 'ctf' is showed instead of the expected file >> > >>'ctf-data', this folder only contains the raw metadata and >> > >>perf-stream files but not analysed. >> > >CC-ing Alexandre from tracecompass devel ^^^ >> > >> > Hi, >> > >> > I just came back from vacation, sorry for not replying earlier! >> > >> > I managed to compile perf with CTF support, but by using Babeltrace's commit >> > 5584a48. It fails to compile against current master, because of private >> > headers getting exposed. I reported that to the BT maintainers. >> >> there's fix in babeltrace tree already >> >> > >> > Then it seems there's another bug with Trace Compass's current master, trace >> > validation cannot fail, and any file will get imported with no errors. We >> > will look into this. >> > But the root of the problem was that the converted CTF trace was not being >> > recognized as valid. This is because some events define "stream_id = 0;", >> > and others don't specify a stream_id at all. It seems quite random, see the >> > full metadata here: http://pastebin.com/pACgV5JU >> > >> > Is there a reason why some events specify a stream_id and some don't? >> >> hum, that seems like a bug.. I'll check >> > > ok, found the problem.. the "stream_id" event_class's attribute is created > only when the instance of the event (not event_class) is created > > so you'll see the stream_id attribute only for events, that > we actually got data for.. the rest is without, because > their instance was never created > > seems to me like libbabeltrace bug, unless the application should > take care about stream_id attribute.. but it's not the case for > the rest of the 'internal' attributes.. Jeremie? According to the spec, the stream_id attribute can be left unspecified if only one stream is defined. However, is seems Babeltrace's CTF-Writer will leave the stream_id out of the event's declaration even when multiple streams are defined. I'll submit a fix. Thanks. Jérémie > > anyway, I made a attached workaround and it all works nicely again, > tracecompass is happy and shows the data properly > > I put all the pending ctf changes (plus the workaround) into: > git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > perf/ctf branch > > jirka > > > --- > diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c > index 977cc3f98d8f..d7f03dcb1700 100644 > --- a/tools/perf/util/data-convert-bt.c > +++ b/tools/perf/util/data-convert-bt.c > @@ -803,6 +803,7 @@ static int add_generic_types(struct ctf_writer *cw, struct perf_evsel *evsel, > static int add_event(struct ctf_writer *cw, struct perf_evsel *evsel) > { > struct bt_ctf_event_class *event_class; > + struct bt_ctf_event *event; > struct evsel_priv *priv; > const char *name = perf_evsel__name(evsel); > int ret; > @@ -833,6 +834,14 @@ static int add_event(struct ctf_writer *cw, struct perf_evsel *evsel) > if (!priv) > goto err; > > + event = bt_ctf_event_create(event_class); > + if (!event) { > + pr_err("Failed to create an CTF event\n"); > + goto err; > + } > + > + bt_ctf_event_put(event); > + > priv->event_class = event_class; > evsel->priv = priv; > return 0; -- Jérémie Galarneau EfficiOS Inc. http://www.efficios.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/