summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-08-27 19:58:51 +0100
committerRobert Bragg <robert@linux.intel.com>2012-09-03 15:51:45 +0100
commit69c6d50774dd4cbd2c454a360a59d13b6f3c3fc8 (patch)
tree5cf4b583fd4be9e11d876f93c522c6af7279ccba /tests
parentac72d0685c3b0f5a8c0e79a75189392c841972ad (diff)
downloadcogl-69c6d50774dd4cbd2c454a360a59d13b6f3c3fc8.tar.gz
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> (cherry picked from commit 66b3d23c201b2e7dd74602e6e6e6c2d8ead47bcd)
Diffstat (limited to 'tests')
-rw-r--r--tests/micro-perf/test-journal.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/micro-perf/test-journal.c b/tests/micro-perf/test-journal.c
index 0d7d4c49..2bf2a279 100644
--- a/tests/micro-perf/test-journal.c
+++ b/tests/micro-perf/test-journal.c
@@ -2,6 +2,8 @@
#include <cogl/cogl2-experimental.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;
}