[lttng-dev] BabelTrace API

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Feb 9 08:50:50 EST 2012

Hi Salman,

* Salman Rafiq (salman.rafiq at esk.fraunhofer.de) wrote:
> Dear Mathieu,
> It's me again :). I wanted to know if it is possible to use BabelTrace
> library/API to read CTF trace from an external application?
> What I wanted to achieve in my application is, to read CTF kernel trace
> generated via LTTng 2.0 and select particular events (say number of times
> the application switched_in or out) along with their timestamps and reuse
> this information. 

Yes, it should be possible. This week and next week, I am merging the
last missing features from Julien for seeking in traces.

> But the problem is after the installation of babeltrace, the header files in
> /usr/local/include/babeltrace are limited to only 5 files namely:
> babeltrace.h  context.h  format.h  iterator.h  trace-handle.h
> Also format.h further includes <babeltrace/types.h> which ofcourse could not
> be found in include dir path.

Julien, is this fixed by your latest patches ?

> Is there any example or doxygen for Babeltrace API that can be used to
> manipulate trace data?

Not at this time, but Julien will soon come up with a LTTngTop
implementation, and Yannick will come up with LTTV, which will both be
references as to how this API can be used.

> Last but not least, the time stamp resolution for LTTng trace is
> approximately 1ns, which is achieved through timespec struct with
> "CLOCK_MONOTONIC" option? I got little confused as I also see in some of
> your mailing lists where CLOCK_TRACE is defined, how does this differs from
> monotonic clock? 

This is defined by the "freq" field in the clock description. Please
refer to the CTF spec to see how things are expressed, found at

I just added support for the "freq" field within babeltrace this
morning, with commit 25ccc85ba8fce5fb8402f1c6fc63a75ff7f07d99. The
behavior when no freq field is found in the clock description is to
assume the clock runs at 1000000000HZ (increments each ns). The
babeltrace output rescales this clocks to show increments of 1ns.
Currently, this rescaling operation is performed within the babeltrace.c
converter file, but I think it might be good if Julien and Yannick (who
are working on the API) could export this feature in the library.

Best regards,


> Anxiously waiting for your reply.
> Best Regards,
> Salman
> --
> Salman Rafiq
> Industrial Communication
> Fraunhofer-Einrichtung für Systeme der Kommunikationstechnik ESK
> Hansastraße 32 | 80686 München
> Telefon, Fax:  +49 89 547088-356 | +49 89 547088-66-356
> E-Mail:   salman.rafiq at esk.fraunhofer.de
> Internet: 
> http://www.esk.fraunhofer.de
> http://www.facebook.com/FraunhoferESK
> http://www.twitter.com/FraunhoferESK
> -----Ursprüngliche Nachricht-----
> Von: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] 
> Gesendet: Monday, January 16, 2012 5:40 PM
> An: Salman Rafiq
> Betreff: Re: AW: AW: babeltrace error
> * Salman Rafiq (salman.rafiq at esk.fraunhofer.de) wrote:
> > 
> > Dear Mathieu,
> > 
> > Does LTTV view supports access and processing of CTF format yet for
> > Trace Visualization? I was curious since the website
> > http://lttng.org/lttng2.0 mentions that it does not support it yet.
> Not yet, but we are working on it. We target mid-february for LTTV
> support for LTTng 2.0 traces.
> > Which other open source/commercial tools can be used to Visualize CTF
> traces?
> The Eclipse Linux Tools LTTng integration is currently being reworked to
> support CTF traces. We should expect this work to be completed this
> winter too. But meanwhile, I know that silicon vendors are in the
> process of moving some of their tools to this format, but I guess it
> will come gradually.
> Best regards,
> Mathieu
> > 
> > Wish you a very nice weekend.
> > 
> > Regards,
> > Salman
> > 
> -- 
> Mathieu Desnoyers
> Operating System Efficiency R&D Consultant
> EfficiOS Inc.
> http://www.efficios.com

Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.

More information about the lttng-dev mailing list