test-random-text: Convert to a micro-benchmark
test-random-text is moved to the micro-bench directory. It now prints out the time taken to draw every 10 frames.
This commit is contained in:
parent
65f449bdb0
commit
1e45428483
@ -36,7 +36,6 @@ UNIT_TESTS = \
|
||||
test-cogl-tex-polygon.c \
|
||||
test-cogl-multitexture.c \
|
||||
test-stage-read-pixels.c \
|
||||
test-random-text.c \
|
||||
test-clip.c \
|
||||
test-paint-wrapper.c \
|
||||
test-texture-quality.c \
|
||||
|
@ -3,7 +3,8 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
|
||||
noinst_PROGRAMS = \
|
||||
test-text \
|
||||
test-picking \
|
||||
test-text-perf
|
||||
test-text-perf \
|
||||
test-random-text
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir)/ \
|
||||
@ -23,4 +24,5 @@ AM_LDFLAGS = $(CLUTTER_LIBS)
|
||||
test_text_SOURCES = test-text.c
|
||||
test_picking_SOURCES = test-picking.c
|
||||
test_text_perf_SOURCES = test-text-perf.c
|
||||
test_random_text_SOURCES = test-random-text.c
|
||||
|
||||
|
@ -23,6 +23,8 @@ on_idle (gpointer data)
|
||||
char font_name[64];
|
||||
int i;
|
||||
GList *children, *node;
|
||||
static GTimer *timer = NULL;
|
||||
static int frame_count = 0;
|
||||
|
||||
/* Remove all of the children of the stage */
|
||||
children = clutter_container_get_children (CLUTTER_CONTAINER (stage));
|
||||
@ -64,11 +66,24 @@ on_idle (gpointer data)
|
||||
xpos += clutter_actor_get_width (label);
|
||||
}
|
||||
|
||||
if (timer == NULL)
|
||||
timer = g_timer_new ();
|
||||
else
|
||||
{
|
||||
if (++frame_count >= 10)
|
||||
{
|
||||
printf ("10 frames in %f seconds\n",
|
||||
g_timer_elapsed (timer, NULL));
|
||||
g_timer_start (timer);
|
||||
frame_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT int
|
||||
test_random_text_main (int argc, char **argv)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage;
|
||||
|
Loading…
x
Reference in New Issue
Block a user