gst/gstinfo.c: make the time that debugging functions print relative to when gst_init...
authorBenjamin Otte <otte@gnome.org>
Sat, 19 Feb 2005 12:59:45 +0000 (12:59 +0000)
committerBenjamin Otte <otte@gnome.org>
Sat, 19 Feb 2005 12:59:45 +0000 (12:59 +0000)
Original commit message from CVS:
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_log_default):
make the time that debugging functions print relative to when
gst_init was called

ChangeLog
gst/gstinfo.c

index c5fbd18..251c351 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-19  Benjamin Otte  <in7y118@public.uni-hamburg.de>
+
+       * gst/gstinfo.c: (_gst_debug_init), (gst_debug_log_default):
+         make the time that debugging functions print relative to when
+         gst_init was called
+
 2005-02-18  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/gsttaginterface.c:
index 616b81f..ac1cd08 100644 (file)
@@ -47,6 +47,8 @@
 
 /* underscore is to prevent conflict with GST_CAT_DEBUG define */
 GST_DEBUG_CATEGORY_STATIC (_GST_CAT_DEBUG);
+/* time of initialization, so we get useful debugging output times */
+GstClockTime start_time;
 
 #if 0
 #if defined __sgi__
@@ -203,9 +205,15 @@ __gst_in_valgrind (void)
 void
 _gst_debug_init (void)
 {
+  GTimeVal current;
+
   gst_atomic_int_init (&__default_level, GST_LEVEL_DEFAULT);
   gst_atomic_int_init (&__use_color, 1);
 
+  /* get time we started for debugging messages */
+  g_get_current_time (&current);
+  start_time = GST_TIMEVAL_TO_TIME (current);
+
 #ifdef HAVE_PRINTF_EXTENSION
   register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension,
       _gst_info_printf_extension_arginfo);
@@ -494,6 +502,7 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
   gchar *pidcolor;
   gint pid;
   GTimeVal now;
+  GstClockTime elapsed;
 
   if (level > gst_debug_category_get_threshold (category))
     return;
@@ -516,10 +525,11 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
   obj = object ? gst_debug_print_object (object) : g_strdup ("");
 
   g_get_current_time (&now);
+  elapsed = GST_TIMEVAL_TO_TIME (now) - start_time;
   g_printerr ("%s (%p - %" GST_TIME_FORMAT
       ") %s%15s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n",
       gst_debug_level_get_name (level), g_thread_self (),
-      GST_TIME_ARGS (GST_TIMEVAL_TO_TIME (now)), color,
+      GST_TIME_ARGS (elapsed), color,
       gst_debug_category_get_name (category), clear, pidcolor, pid, clear,
       color, file, line, function, obj, clear, gst_debug_message_get (message));