tracer: Allow outputting logs (in particular tracer logs) in Common Trace Format (ctf)
@thiblahute
Submitted by Thibault Saunier Link to original bug (#772936)
Description
Currently we are going through the standard GStreamer logging subsystem to output the tracer logs, but it has several issues:
- it has not been designed to output structured data
- it is a plain text format which is not optimal at all in term of speed to write as well as size of the output
- it is not a standardized format and we need to write our own tools to analyze the traces
- we currently use a lock around each call to the debug function which is suboptimal
Starting from that I think many of us agree (from conversations we had during the hackfest) that a nice way to solve those issues would be to allow outputting our traces as Common Trace Format[0]. This format is used by the lttng[1] project and is the main tracing format outputted by the Linux kernel. Many tools are available from the LTTNG project and we can use the babeltrace[2] library to simplify CTF trace generation (the important part of the library is licenced under MIT[3] so we should not have any problem using it in GStreamer core ifaiu).
Also during the hackfest we talked about the possibility to use that same format to ouput our debug logs, but that work will be part of another bug.
This feature can currently be activated through the GST_DEBUG_FORMAT=ctf,directory=/some/dir environment variable, and this same variable should be used for any format (still supporting the GST_DEBUG_FILE var too).
I am attaching here the first iteration of the implementation.
[0] http://diamon.org/ctf/
[1] http://lttng.org/
[2] http://diamon.org/babeltrace/
[3] https://github.com/efficios/babeltrace/blob/master/LICENSE