From d7acb27dee6a70c035db80ab6dd22c15fa08b0c0 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Wed, 10 Sep 2014 08:32:18 +0200 Subject: [PATCH] tracer: use GST_PTR_FORMAT to log the structure This way we only expand the structure when we're logging. This allows us to meassure the pure tracing seperately from the logging. Also add some comments on further improvements. --- gst/gsttracer.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gst/gsttracer.c b/gst/gsttracer.c index 42ec2b66c7..df973f3900 100644 --- a/gst/gsttracer.c +++ b/gst/gsttracer.c @@ -203,11 +203,21 @@ gst_tracer_register (GstPlugin * plugin, const gchar * name, GType type) void gst_tracer_log_trace (GstStructure * s) { - gchar *data; - - // TODO(ensonic): use a GVariant? - data = gst_structure_to_string (s); - GST_TRACE ("%s", data); - g_free (data); + GST_TRACE ("%" GST_PTR_FORMAT, s); + /* expands to: + gst_debug_log_valist ( + GST_CAT_DEFAULT, GST_LEVEL_TRACE, + file, func, line, object + "%" GST_PTR_FORMAT, s); + // does it make sense to use the {file, line, func} from the tracer hook? + // a) + // - we'd need to pass them in the macros to gst_tracer_dispatch() + // - and each tracer needs to grab them from the va_list and pass them here + // b) + // - we create a content in dispatch, pass that to the tracer + // - and the tracer will pass that here + // ideally we also use *our* ts instead of the one that + // gst_debug_log_default() will pick + */ gst_structure_free (s); }