diff options
author | Ryan Lortie <desrt@desrt.ca> | 2013-02-21 17:47:08 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-05-23 21:50:53 -0400 |
commit | 8bb6a4aec5dbc7535244a0fa2b96b728eebe75cc (patch) | |
tree | 1e0b0f7b0fbfdce9a7063017d49bf3220a3c3003 /tests/gobject | |
parent | 4b72bbf9b18a698555bb2aa914b9ab5fd0a4e5f3 (diff) | |
download | glib-8bb6a4aec5dbc7535244a0fa2b96b728eebe75cc.tar.gz |
performance test: add signal test with args
Add a signal that has some typical arguments (a uint and a pointer)
since all of the other signal performance tests are for signals with no
args.
https://bugzilla.gnome.org/show_bug.cgi?id=694380
Diffstat (limited to 'tests/gobject')
-rw-r--r-- | tests/gobject/performance.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/gobject/performance.c b/tests/gobject/performance.c index d41955ffa..fdc51da28 100644 --- a/tests/gobject/performance.c +++ b/tests/gobject/performance.c @@ -275,6 +275,7 @@ enum { COMPLEX_SIGNAL_EMPTY, COMPLEX_SIGNAL_GENERIC, COMPLEX_SIGNAL_GENERIC_EMPTY, + COMPLEX_SIGNAL_ARGS, COMPLEX_LAST_SIGNAL }; @@ -381,6 +382,15 @@ complex_object_class_init (ComplexObjectClass *class) NULL, G_TYPE_NONE, 0); + complex_signals[COMPLEX_SIGNAL_ARGS] = + g_signal_new ("signal-args", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (ComplexObjectClass, signal), + NULL, NULL, + g_cclosure_marshal_VOID__UINT_POINTER, + G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER); + g_object_class_install_property (object_class, PROP_VAL1, g_param_spec_int ("val1", @@ -622,6 +632,18 @@ test_emission_run (PerformanceTest *test, g_signal_emit (object, data->signal_id, 0); } +static void +test_emission_run_args (PerformanceTest *test, + gpointer _data) +{ + struct EmissionTest *data = _data; + GObject *object = data->object; + int i; + + for (i = 0; i < data->n_checks; i++) + g_signal_emit (object, data->signal_id, 0, 0, NULL); +} + /************************************************************* * Test signal unhandled emissions performance *************************************************************/ @@ -703,6 +725,9 @@ test_emission_handled_setup (PerformanceTest *test) g_signal_connect (data->object, "signal-generic-empty", G_CALLBACK (test_emission_handled_handler), NULL); + g_signal_connect (data->object, "signal-args", + G_CALLBACK (test_emission_handled_handler), + NULL); return data; } @@ -820,6 +845,16 @@ static PerformanceTest tests[] = { test_emission_unhandled_print_result }, { + "emit-unhandled-args", + GINT_TO_POINTER (COMPLEX_SIGNAL_ARGS), + test_emission_unhandled_setup, + test_emission_unhandled_init, + test_emission_run_args, + test_emission_unhandled_finish, + test_emission_unhandled_teardown, + test_emission_unhandled_print_result + }, + { "emit-handled", GINT_TO_POINTER (COMPLEX_SIGNAL), test_emission_handled_setup, @@ -858,6 +893,16 @@ static PerformanceTest tests[] = { test_emission_handled_finish, test_emission_handled_teardown, test_emission_handled_print_result + }, + { + "emit-handled-args", + GINT_TO_POINTER (COMPLEX_SIGNAL_ARGS), + test_emission_handled_setup, + test_emission_handled_init, + test_emission_run_args, + test_emission_handled_finish, + test_emission_handled_teardown, + test_emission_handled_print_result } }; |