From 4ddc94f55e7b9ea0614a9ba32633a9bc673129e2 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Sun, 27 Sep 2009 10:56:06 +0200 Subject: test/gobject/performance-threaded: Add complex/emit tests. These are (roughly) the same tests as in performance, except that we can properly test contention with performance-threaded --- tests/gobject/performance-threaded.c | 39 +++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/tests/gobject/performance-threaded.c b/tests/gobject/performance-threaded.c index bb6347f5e..16e6f5d88 100644 --- a/tests/gobject/performance-threaded.c +++ b/tests/gobject/performance-threaded.c @@ -154,7 +154,7 @@ simple_object_get_class_type (void) } static void -simple_creation_destruction_run (gpointer data) +object_creation_destruction_run (gpointer data) { guint i; for (i = 1000; i; i--) { @@ -171,6 +171,29 @@ instance_creation_destruction_run (gpointer data) } } +static gpointer +create_new_complex_object (void) +{ + return g_object_new (COMPLEX_TYPE_OBJECT, NULL); +} + +static void +complex_emission_run (gpointer data) +{ + GObject *object = (GObject *) data; + guint i; + + for (i = 1000; i; i--) { + complex_object_emit (object); + } +} + +static void +complex_emission_teardown (gpointer data) +{ + g_object_unref (data); +} + #if 0 /* DUMB test doing nothing */ @@ -234,14 +257,24 @@ static const PerformanceTest tests[] = { no_teardown }, { "simple-creation-destruction", simple_object_get_type, - simple_creation_destruction_run, + object_creation_destruction_run, no_reset, no_teardown }, { "simple-creation-destruction-created", simple_object_get_class_type, - simple_creation_destruction_run, + object_creation_destruction_run, + no_reset, + no_teardown }, + { "complex-creation-destruction", + complex_object_get_type, + object_creation_destruction_run, no_reset, no_teardown }, + { "emit-signal", + create_new_complex_object, + complex_emission_run, + no_reset, + complex_emission_teardown }, #if 0 { "nothing", no_setup, -- cgit v1.2.3