gst: debug: Add information about active tracers in dot files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8820>
This commit is contained in:
parent
67cafe5999
commit
33f58f9da7
@ -60,6 +60,7 @@
|
||||
#include "gstobject.h"
|
||||
#include "gstghostpad.h"
|
||||
#include "gstpad.h"
|
||||
#include "gsttracer.h"
|
||||
#include "gstutils.h"
|
||||
#include "gstvalue.h"
|
||||
#include "gstidstr-private.h"
|
||||
@ -109,7 +110,8 @@ debug_dump_get_element_state (GstElement * element)
|
||||
|
||||
static gchar *
|
||||
debug_dump_get_object_params (GObject * object,
|
||||
GstDebugGraphDetails details, const char *const *ignored_propnames)
|
||||
GstDebugGraphDetails details, const char *const *ignored_propnames,
|
||||
const gchar * prop_separator)
|
||||
{
|
||||
gchar *param_name = NULL;
|
||||
GParamSpec **properties, *property;
|
||||
@ -215,12 +217,13 @@ debug_dump_get_object_params (GObject * object,
|
||||
tmp = (char *) "";
|
||||
|
||||
if (details & GST_DEBUG_GRAPH_SHOW_FULL_PARAMS) {
|
||||
param_name = g_strdup_printf ("%s\\n%s=%s", tmp, property->name,
|
||||
param_name =
|
||||
g_strdup_printf ("%s%s%s=%s", tmp, prop_separator, property->name,
|
||||
value_str);
|
||||
} else {
|
||||
param_name = g_strdup_printf ("%s\\n%s=%."
|
||||
G_STRINGIFY (PARAM_MAX_LENGTH) "s%s", tmp, property->name,
|
||||
value_str, ellipses);
|
||||
param_name = g_strdup_printf ("%s%s%s=%."
|
||||
G_STRINGIFY (PARAM_MAX_LENGTH) "s%s", tmp, prop_separator,
|
||||
property->name, value_str, ellipses);
|
||||
}
|
||||
|
||||
if (tmp[0] != '\0')
|
||||
@ -264,7 +267,8 @@ debug_dump_pad (GstPad * pad, const gchar * color_name,
|
||||
}
|
||||
|
||||
param_name =
|
||||
debug_dump_get_object_params (G_OBJECT (pad), details, ignore_propnames);
|
||||
debug_dump_get_object_params (G_OBJECT (pad), details, ignore_propnames,
|
||||
"\n");
|
||||
if (details & GST_DEBUG_GRAPH_SHOW_STATES) {
|
||||
gchar pad_flags[5];
|
||||
const gchar *activation_mode = "-><";
|
||||
@ -643,7 +647,7 @@ debug_dump_element (GstBin * bin, GstDebugGraphDetails details,
|
||||
}
|
||||
if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) {
|
||||
param_name = debug_dump_get_object_params (G_OBJECT (element),
|
||||
details, ignore_propnames);
|
||||
details, ignore_propnames, "\n");
|
||||
}
|
||||
/* elements */
|
||||
g_string_append_printf (str, "%ssubgraph cluster_%s {\n", spc,
|
||||
@ -759,17 +763,53 @@ debug_dump_element (GstBin * bin, GstDebugGraphDetails details,
|
||||
gst_iterator_free (element_iter);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
debug_dump_get_tracers_info (GstDebugGraphDetails details)
|
||||
{
|
||||
GList *tracers, *tmp;
|
||||
|
||||
tracers = gst_tracing_get_active_tracers ();
|
||||
if (!tracers)
|
||||
return NULL;
|
||||
|
||||
GString *str = g_string_new ("Active Tracers:");
|
||||
for (tmp = tracers; tmp; tmp = tmp->next) {
|
||||
GObject *tracer = G_OBJECT (tmp->data);
|
||||
gchar *props = NULL;
|
||||
|
||||
g_string_append_printf (str, "\\l - %s", G_OBJECT_TYPE_NAME (tracer));
|
||||
if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) {
|
||||
props =
|
||||
debug_dump_get_object_params (tracer, details, NULL, "\\l * ");
|
||||
if (props) {
|
||||
g_string_append_c (str, ':');
|
||||
g_string_append_printf (str, " %s", props);
|
||||
}
|
||||
g_free (props);
|
||||
}
|
||||
|
||||
/* Make sure each tracer line ends with \l even if it has no properties */
|
||||
g_string_append (str, "\\l");
|
||||
|
||||
}
|
||||
|
||||
g_list_free (tracers);
|
||||
return g_string_free (str, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
debug_dump_header (GstBin * bin, GstDebugGraphDetails details, GString * str)
|
||||
{
|
||||
gchar *state_name = NULL;
|
||||
gchar *param_name = NULL;
|
||||
gchar *tracers_info = NULL;
|
||||
|
||||
if (details & GST_DEBUG_GRAPH_SHOW_STATES) {
|
||||
state_name = debug_dump_get_element_state (GST_ELEMENT (bin));
|
||||
}
|
||||
if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) {
|
||||
param_name = debug_dump_get_object_params (G_OBJECT (bin), details, NULL);
|
||||
param_name =
|
||||
debug_dump_get_object_params (G_OBJECT (bin), details, NULL, "\n");
|
||||
}
|
||||
|
||||
/* write header */
|
||||
@ -795,10 +835,23 @@ debug_dump_header (GstBin * bin, GstDebugGraphDetails details, GString * str)
|
||||
(state_name ? state_name : ""), (param_name ? param_name : "")
|
||||
);
|
||||
|
||||
tracers_info = debug_dump_get_tracers_info (details);
|
||||
if (tracers_info) { /* More than just "Active Tracers:\l" */
|
||||
g_string_append_printf (str,
|
||||
" tracers [\n"
|
||||
" pos=\"0,0!\",\n"
|
||||
" margin=\"0.05,0.05\",\n"
|
||||
" style=\"filled\",\n"
|
||||
" fillcolor=\"#e0e0ff\",\n"
|
||||
" label=\"%s\",\n" " ];\n" "\n", tracers_info);
|
||||
}
|
||||
|
||||
if (state_name)
|
||||
g_free (state_name);
|
||||
if (param_name)
|
||||
g_free (param_name);
|
||||
if (tracers_info)
|
||||
g_free (tracers_info);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
x
Reference in New Issue
Block a user