From 109f7a0d64257048b7523c052c4b69f0c352330b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 24 Dec 2001 12:30:09 +0000 Subject: [PATCH] Added some more stats about iteration times Original commit message from CVS: Added some more stats about iteration times --- tools/gstreamer-launch.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/tools/gstreamer-launch.c b/tools/gstreamer-launch.c index 7afae06..10fa963 100644 --- a/tools/gstreamer-launch.c +++ b/tools/gstreamer-launch.c @@ -8,6 +8,11 @@ static int launch_argc; static char **launch_argv; +static guint64 iterations = 0; +static guint64 sum = 0; +static guint64 min = G_MAXINT; +static guint64 max = 0; + #ifndef USE_GLIB2 GtkWidget *window; GtkWidget *gtk_socket; @@ -62,12 +67,29 @@ arg_search (GstBin *bin, gchar *argname, found_handler handler, void *priv) gboolean idle_func (gpointer data) { - if (!gst_bin_iterate (GST_BIN (data))) { + gboolean busy; + struct timeval tfthen, tfnow; + guint64 diff; + + gettimeofday (&tfthen, (struct timezone *)NULL); + busy = gst_bin_iterate (GST_BIN (data)); + iterations++; + gettimeofday (&tfnow, (struct timezone *)NULL); + + diff = ((guint64)tfnow.tv_sec*1000000LL+tfnow.tv_usec) - + ((guint64)tfthen.tv_sec*1000000LL+tfthen.tv_usec); + + sum += diff; + min = MIN (min, diff); + max = MAX (max, diff); + + if (!busy) { gst_main_quit (); - g_print ("iteration ended\n"); - return FALSE; + g_print ("execution ended after %llu iterations (sum %llu us, average %llu us, min %llu us, max %llu us)\n", + iterations, sum, sum/iterations, min, max); } - return TRUE; + + return busy; } void -- 2.7.4