BabelTrace as Library

203 Views Asked by At

I’m trying to use the babeltrace library to be able to load and read a CTF trace in a C program.

From the doc:

In order to use libbabeltrace to read a trace, the first step is to create a context structure and to add a trace to it. This is done using the bt_context_create() and bt_context_add_trace() functions. As long as this context structure is allocated and the trace is valid, the trace can be manipulated by the library.

But for a simple program like this:

#include <stdio.h>
#include <babeltrace/context.h>

int main(void){

     struct bt_context *ctx = bt_context_create();

     int ret = bt_context_add_trace(ctx, "/home/alex/trace/ffmpeg/kernel/", "ctf", NULL, NULL, NULL);

     return ret; 
 }

I got the following error message:

[error] [Context] Format "ctf" unknown.

and ret = -1.

The trace is a valide CTF trace that I can read using the babeltrace program.please help me.

1

There are 1 best solutions below

0
sai kiran On

Use babel trace 1.5.2 version instead of 1.5.1, definitely everything goes well. If anyone having issues send to me, thanks.