From mboxrd@z Thu Jan 1 00:00:00 1970 From: jonathan.rajotte-julien@efficios.com (Jonathan Rajotte-Julien) Date: Tue, 17 Sep 2019 15:17:56 -0400 Subject: [lttng-dev] Python CTF writer example In-Reply-To: References: Message-ID: <20190917191756.GD143064@joraj-alpa> Hi, On Fri, Sep 13, 2019 at 07:03:59PM -0400, Francis Giraldeau wrote: > Hello! > > It looks like there are some issues with the Python CTF writer example with > babeltrace stable-1.5. I will infer that you are looking at this doc: https://diamon.org/babeltrace/docs/python/examples/#ctf-writer-api-examples This doc is currently outdated(invalid). We are in the process of revamping it/removing it. If you need an example for bt 1.5 use: https://github.com/efficios/babeltrace/blob/stable-1.5/bindings/python/babeltrace/examples/ctf_writer.py This example works as expected. > > * Import error, should replace "import babeltrace.writer as btw" by "from > babeltrace import CTFWriter as btw" > * The FloatingPointDeclaration does not exists and should be replaced > by FloatFieldDeclaration > * babeltrace.common.CTFStringEncoding.UTF8 is > instead babeltrace.CTFStringEncoding.UTF8 > * The variant still had issue that I cannot fix (ValueError("Invalid tag > provided.") babeltrace.py:2221) If you still wish to follow the documentation, please make sure to read the green notice here: https://diamon.org/babeltrace/docs/python/examples/#examples > > Events with simple fields are working okay with these changes. I thought > that the clock would be updated automatically when appending the event, but > that would be nice also to add it to the example. > > I tried babeltrace 2.0.0-pre6, but the writer API seems to have > disappeared. I was looking at how to create a ctf.fs.sink, but I was not > successful. Is writing CTF traces with the Python bindings still possible? The ctf-writer capability are not part of the bindings anymore. https://review.lttng.org/c/babeltrace/+/1392 What can be done is writing a source plugin using the bindings and use a ctf sink on the cli to generate a ctf trace. A quick source plugin: http://paste.ubuntu.com/p/8CBqTt8cSj/ Note that babeltrace 1.5 and babeltrace 2 can coexist on the same system. Allowing you to still use the bindings from bt1.5 to generate traces. I recommend that you stick with the babeltrace 1.5 bindings (import babeltrace). Cheers -- Jonathan Rajotte-Julien EfficiOS