Babeltrace 2.0.0-pre Python bindings

Generated on October 31, 2016.

Welcome!

Welcome to Babeltrace's Python bindings' documentation!

Babeltrace is a trace format converter. It is able to read and write different trace formats, such as the Common Trace Format (CTF). Babeltrace also acts as the CTF reference implementation.

The Babeltrace Python bindings rely on the libbabeltrace library, the current public C API of Babeltrace.

Installing

The Python bindings may be enabled when configuring Babeltrace's build:

./configure --enable-python-bindings

On Debian and Ubuntu, the Python bindings are available in the python3-babeltrace package.

Note

Currently, the Babeltrace Python bindings only works with Python 3.

Bindings

Important

The bindings documented here are the ones of Babeltrace 2, which is not yet released. If you're using a Babeltrace 1.x release, all the names are in the same module named babeltrace. In this case:

  • The names found in the babeltrace.common module (documented here) can be found in the babeltrace module directly.

    For example, instead of:

    import babeltrace.common
    
    scope = babeltrace.common.CTFScope.EVENT_CONTEXT
    

    do:

    import babeltrace
    
    scope = babeltrace.CTFScope.EVENT_CONTEXT
    
  • The names found in the babeltrace.reader module (documented here) can be found in the babeltrace module directly.

    For example, instead of:

    import babeltrace.reader
    
    trace_collection = babeltrace.reader.TraceCollection()
    

    do:

    import babeltrace
    
    trace_collection = babeltrace.TraceCollection()
    
  • The names found in the babeltrace.writer module (documented here) can be found in the CTFWriter class in the babeltrace module.

    For example, instead of:

    import babeltrace.writer
    
    event_class = babeltrace.writer.EventClass('my_event')
    

    do:

    from babeltrace import CTFWriter
    
    event_class = CTFWriter.EventClass('my_event')
    

The Babeltrace Python bindings are available as a single Python package, babeltrace.

The Babeltrace Python bindings' API is divided into two parts:

  • The reader API is exposed by the babeltrace.reader module, a set of classes used to open a collection of different traces and iterate on their events.
  • The CTF writer API is exposed by the babeltrace.writer module, which makes it possible to write a complete CTF trace from scratch.

Note

For backward compatibility reasons, the reader API is imported in the package itself. The CTF writer API is imported in the package itself too, as CTFWriter. It is, however, strongly recommended to import and use the three modules (babeltrace.common, babeltrace.reader, and babeltrace.writer) explicitly, since there is no long-term plan to maintain the compatibility layer.

Contents: