From 4f1eb84444a5f4392581bf9c3d1825af8c7526d9 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Mon, 8 Oct 2012 18:11:30 +0000 Subject: [PATCH] Log the time we spend waiting for the capture child to exit. Add breadcrumbs so that we can switch from g_get_current_time to g_get_real_time when our minimum GLib version is >= 2.28. svn path=/trunk/; revision=45399 --- capture_sync.c | 14 +++++++++++++- file.c | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/capture_sync.c b/capture_sync.c index d7afd422d1..013d8224ce 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -1738,6 +1738,15 @@ sync_pipe_wait_for_child(int fork_child, gchar **msgp) { int fork_child_status; int ret; + GTimeVal start_time; + GTimeVal end_time; + float elapsed; + + /* + * GLIB_CHECK_VERSION(2,28,0) adds g_get_real_time which could minimize or + * replace this + */ + g_get_current_time(&start_time); g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_wait_for_child: wait till child closed"); g_assert(fork_child != -1); @@ -1792,7 +1801,10 @@ sync_pipe_wait_for_child(int fork_child, gchar **msgp) } #endif - g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_wait_for_child: capture child closed"); + g_get_current_time(&end_time); + elapsed = (end_time.tv_sec - start_time.tv_sec) + + ((end_time.tv_usec - start_time.tv_usec) / 1e6); + g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_wait_for_child: capture child closed after %.3fs", elapsed); return ret; } diff --git a/file.c b/file.c index c63e5c035c..46c48885de 100644 --- a/file.c +++ b/file.c @@ -258,6 +258,10 @@ static void reset_elapsed(void) computed_elapsed = 0; } +/* + * GLIB_CHECK_VERSION(2,28,0) adds g_get_real_time which could minimize or + * replace this + */ static void compute_elapsed(GTimeVal *start_time) { gdouble delta_time;