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

Alexis Martin alexis.martin at inria.fr
Thu Feb 25 12:31:53 EST 2016


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20160225/9f5213d7/attachment.html>


More information about the lttng-dev mailing list