[lttng-dev] Unable to read events using babeltrace C library

Philippe Proulx eeppeliteloop at gmail.com
Thu Feb 25 15:16:05 EST 2016


Alexis,

Thanks for asking.

There's an upcoming version of Babeltrace (2.0) in which the Babeltrace
1.x C API will be removed. Please note that the current Python API will
work as is in Babeltrace 2.0. Babeltrace 2.0 is plugin-based and certain
design decisions (reference counting, opaque pointers, to name a few)
differ too much from Babeltrace 1.x to keep its API.

The current master branch is in a transition state from Babeltrace 1.x
to Babeltrace 2.0, which is why you're stumbling upon API-breaking
changes like public headers becoming private. Our only goal for the
master branch is to keep the converter (babeltrace executable) and the
Python bindings working.

You'll notice that configure.ac uses 2.0.0-pre as the project version.

If you want to use the Babeltrace 1.x C API, you should use the latest
stable 1.x branch:
<https://github.com/efficios/babeltrace/tree/stable-1.3>.

Stay tuned for the release of Babeltrace 2.0, which will expose a richer
and safer C API to produce, transform/filter, and consume events.

BR,
Philippe Proulx

On Thu, Feb 25, 2016 at 12:31 PM, Alexis Martin <alexis.martin at inria.fr> wrote:
> Hi,
>
> I want to use the babeltrace C library to read a CTF trace in my program,
> but I’m facing some problems.
>
> I was able to create a bt_context and load a trace (I can get the begin and
> end timestamps).
> But then, it seems some functions are missing in the library headers:
>
> The API.txt file in the doc folder says:
>
> A CTF event is obtained from an iterator via the bt_ctf_iter_read_event()
> function or via the call_data parameter of a callback. To read the data of a
> CTF event :
> * bt_ctf_event_name() returns the name of the event;
> * bt_ctf_get_timestamp() returns the timestamp of the event
> offsetted with the system clock
> source (in ns);
> * bt_ctf_get_cycles() returns the timestamp of the event as
> written in the packet (in cycles).
>
>
> Those functions were defined in the include/babeltrace/ctf/events.h file but
> they were moved in file include/babeltrace/ctf/events-internal.h (commit
> 9a19a512f564cbb301b0b5f1377d64e3b3f0a851) which is not part of the include
> files when installing babeltrace.
> Is it normal and the way to access events data has changed ? (The the
> API.txt file is quite old)
> I read on babeltrace website that the version 2 will provide a new API.
>
> Also when I iterate over events the event pointer never changes:
>
>     // get iterator of events
>     struct bt_ctf_iter *envents_iter = bt_ctf_iter_create(ctx, nullptr,
> nullptr);
>     //event pointer
>     struct bt_ctf_event *ev_ptr = nullptr;
>
>     while(true){
>         ev_ptr = bt_ctf_iter_read_event(envents_iter);
>
>         if(! ev_ptr)
>             break;
>         bt_iter_next(bt_ctf_get_iter(envents_iter));
>
>     }
>
>
> Can you tell me if I misuse this library ?
> Thanks!
>> Alexis Martin
> PhD. Student
> INRIA / LIG POLARIS-Team
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>



More information about the lttng-dev mailing list