I want to get more insight of a GStreamer pipeline (statistics, resource usage). I saw that this is possible with GStreamer tracing. But I can't find any documentation how to enable and access these messages from the C API.
I assume that I can enable the tracing by changing the environment variable (GST_TRACERS) from the C code. But I cannot find anything about how I can read these messages from the C code. The GstMessage structure doesn't seem to support tracing messages.
Can someone link me to the GStreamer documentation, or the GStreamer API calls that are necessary to retrieve specific types of tracing? And is it correct that changing the GST_TRACERS environment variable to GST_TRACERS="meminfo" also enables the meminfo tracers for the GStreamer C API calls (or do you need to enable this explicitly from the C API itself)?
Tracing can be enabled through the debug API calls in GStreamer. Debugging can be enabled using: gst_debug_set_active(true)
. Trace logging can be enabled using: gst_debug_set_default_threshold(GST_LEVEL_TRACE)
(or you can use the environment variables: GST_DEBUG=GST_TRACER:7
and GST_TRACERS=rusage;latency;stats
).
By default, these traces are logged to stdout. This behavior can be removed by executing the API call: gst_debug_remove_log_function(gst_debug_log_default);
(see GST Info).
To get these messages in your own method, you should use the function gst_debug_add_log_function
(see GST Info log function).