All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérémie Galarneau" <jeremie.galarneau@efficios.com>
To: Rocky Dunlap <rsdunlapiv@gmail.com>
Cc: "lttng-dev@lists.lttng.org" <lttng-dev@lists.lttng.org>
Subject: Re: Python Babeltrace - Write multiple streams
Date: Tue, 10 Nov 2015 10:12:24 -0500	[thread overview]
Message-ID: <CA+jJMxvv3OV76yzAs2JZrFaop4ZRSwYpgn8n_YqKeJDsrM8opw__32910.5024728507$1447168413$gmane$org@mail.gmail.com> (raw)
In-Reply-To: <CAK-w0Ddnf5TXJfmv=scZ0j6DJ0+PNbPOynKpahN8t1qVDqy=ug@mail.gmail.com>

Hi Rocky,

The code looks good at first glance. Can you try with master and see
if that might be problem that has been fixed since then?

Thanks,
Jérémie

On Fri, Nov 6, 2015 at 9:40 PM, Rocky Dunlap <rsdunlapiv@gmail.com> wrote:
> Using the Babletrace Python binding version 1.3, I adapted a simple example
> to try to write a trace with two streams.  It appears to write okay (no
> errors), but when I attempt to read it back (again using Babeltrace) I get
> an error:
>
> [error] Stream 1 is not declared in metadata.
> [error] Stream index creation error.
> [error] Open file stream error.
> [warning] [Context] Cannot open_trace of format ctf at path ./trace.
>
> Here is my code to write the streams:
>
> ################################
>
> from babeltrace import *
>
> trace_path = "./trace"
>
> print('trace path: {}'.format(trace_path))
>
> writer = CTFWriter.Writer(trace_path)
>
> clock = CTFWriter.Clock('my_clock')
> clock.description = 'this is my clock'
> writer.add_clock(clock)
>
> stream_class = CTFWriter.StreamClass('my_stream')
> stream_class.clock = clock
>
> event_class = CTFWriter.EventClass('my_event')
>
> int32_field_decl = CTFWriter.IntegerFieldDeclaration(32)
> int32_field_decl.signed = True
>
> event_class.add_field(int32_field_decl, 'my_field')
>
> stream_class.add_event_class(event_class)
>
> stream = writer.create_stream(stream_class)
> stream2 = writer.create_stream(stream_class)
>
> event = CTFWriter.Event(event_class)
> event.payload('my_field').value = -23
> stream.append_event(event)
>
> event = CTFWriter.Event(event_class)
> event.payload('my_field').value = -89
> stream.append_event(event)
>
> event = CTFWriter.Event(event_class)
> event.payload('my_field').value = -849
> stream2.append_event(event)
>
> event = CTFWriter.Event(event_class)
> event.payload('my_field').value = 42
> stream2.append_event(event)
>
> stream.flush()
> stream2.flush()
>
> ######################
>
> I am sure I am just not quite using the API correctly.  If you can spot the
> error, please let me know.  Also, if anyone can point me to an example of
> using the python bindings to write out multiple streams, I would appreciate
> it.
>
> Thanks!
> Rocky
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>



-- 
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

       reply	other threads:[~2015-11-10 15:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAK-w0Ddnf5TXJfmv=scZ0j6DJ0+PNbPOynKpahN8t1qVDqy=ug@mail.gmail.com>
2015-11-10 15:12 ` Jérémie Galarneau [this message]
     [not found] ` <CA+jJMxvv3OV76yzAs2JZrFaop4ZRSwYpgn8n_YqKeJDsrM8opw@mail.gmail.com>
2015-11-10 16:37   ` Python Babeltrace - Write multiple streams Rocky Dunlap
     [not found]   ` <CAK-w0DcPucjp6Fjnf04gtDDEFJGwGKKSmCbhny2EaQsv=0VT2w@mail.gmail.com>
2015-11-10 17:49     ` Jérémie Galarneau
2015-11-07  2:40 Rocky Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+jJMxvv3OV76yzAs2JZrFaop4ZRSwYpgn8n_YqKeJDsrM8opw__32910.5024728507$1447168413$gmane$org@mail.gmail.com' \
    --to=jeremie.galarneau@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    --cc=rsdunlapiv@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.