mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-02 09:16:17 +01:00
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
This commit is contained in:
parent
4b72bbf9b1
commit
8bb6a4aec5
@ -275,6 +275,7 @@ enum {
|
|||||||
COMPLEX_SIGNAL_EMPTY,
|
COMPLEX_SIGNAL_EMPTY,
|
||||||
COMPLEX_SIGNAL_GENERIC,
|
COMPLEX_SIGNAL_GENERIC,
|
||||||
COMPLEX_SIGNAL_GENERIC_EMPTY,
|
COMPLEX_SIGNAL_GENERIC_EMPTY,
|
||||||
|
COMPLEX_SIGNAL_ARGS,
|
||||||
COMPLEX_LAST_SIGNAL
|
COMPLEX_LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -381,6 +382,15 @@ complex_object_class_init (ComplexObjectClass *class)
|
|||||||
NULL,
|
NULL,
|
||||||
G_TYPE_NONE, 0);
|
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,
|
g_object_class_install_property (object_class,
|
||||||
PROP_VAL1,
|
PROP_VAL1,
|
||||||
g_param_spec_int ("val1",
|
g_param_spec_int ("val1",
|
||||||
@ -622,6 +632,18 @@ test_emission_run (PerformanceTest *test,
|
|||||||
g_signal_emit (object, data->signal_id, 0);
|
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
|
* Test signal unhandled emissions performance
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
@ -703,6 +725,9 @@ test_emission_handled_setup (PerformanceTest *test)
|
|||||||
g_signal_connect (data->object, "signal-generic-empty",
|
g_signal_connect (data->object, "signal-generic-empty",
|
||||||
G_CALLBACK (test_emission_handled_handler),
|
G_CALLBACK (test_emission_handled_handler),
|
||||||
NULL);
|
NULL);
|
||||||
|
g_signal_connect (data->object, "signal-args",
|
||||||
|
G_CALLBACK (test_emission_handled_handler),
|
||||||
|
NULL);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -819,6 +844,16 @@ static PerformanceTest tests[] = {
|
|||||||
test_emission_unhandled_teardown,
|
test_emission_unhandled_teardown,
|
||||||
test_emission_unhandled_print_result
|
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",
|
"emit-handled",
|
||||||
GINT_TO_POINTER (COMPLEX_SIGNAL),
|
GINT_TO_POINTER (COMPLEX_SIGNAL),
|
||||||
@ -858,6 +893,16 @@ static PerformanceTest tests[] = {
|
|||||||
test_emission_handled_finish,
|
test_emission_handled_finish,
|
||||||
test_emission_handled_teardown,
|
test_emission_handled_teardown,
|
||||||
test_emission_handled_print_result
|
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
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user