[cogl] test-journal: Setup a UProf Mainloop timer



commit 66b3d23c201b2e7dd74602e6e6e6c2d8ead47bcd
Author: Robert Bragg <robert linux intel com>
Date:   Mon Aug 27 19:58:51 2012 +0100

    test-journal: Setup a UProf Mainloop timer
    
    So that we can show a UProf profile when running test-journal the test
    now declares a static "Mainloop" timer which it starts/stops around the
    GLib mainloop it runs.
    
    Reviewed-by: Neil Roberts <neil linux intel com>

 tests/micro-perf/test-journal.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/tests/micro-perf/test-journal.c b/tests/micro-perf/test-journal.c
index 9cd9cba..42de7a5 100644
--- a/tests/micro-perf/test-journal.c
+++ b/tests/micro-perf/test-journal.c
@@ -2,6 +2,8 @@
 #include <cogl/cogl.h>
 #include <math.h>
 
+#include "cogl/cogl-profile.h"
+
 #define FRAMEBUFFER_WIDTH 800
 #define FRAMEBUFFER_HEIGHT 600
 
@@ -141,6 +143,11 @@ main (int argc, char **argv)
   CoglOnscreen *onscreen;
   GSource *cogl_source;
   GMainLoop *loop;
+  COGL_STATIC_TIMER (mainloop_timer,
+                      NULL, //no parent
+                      "Mainloop",
+                      "The time spent in the glib mainloop",
+                      0);  // no application private data
 
   data.ctx = cogl_context_new (NULL, NULL);
 
@@ -176,7 +183,9 @@ main (int argc, char **argv)
   g_timer_start (data.timer);
 
   loop = g_main_loop_new (NULL, TRUE);
+  COGL_TIMER_START (uprof_get_mainloop_context (), mainloop_timer);
   g_main_loop_run (loop);
+  COGL_TIMER_STOP (uprof_get_mainloop_context (), mainloop_timer);
 
   return 0;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]