* with no properties, no signals, implementing no interfaces
*************************************************************/
+static GType simple_object_get_type (void);
#define SIMPLE_TYPE_OBJECT (simple_object_get_type ())
typedef struct _SimpleObject SimpleObject;
typedef struct _SimpleObjectClass SimpleObjectClass;
void (*method) (TestIface *obj);
};
+static GType test_iface1_get_type (void);
+static GType test_iface2_get_type (void);
+static GType test_iface3_get_type (void);
+static GType test_iface4_get_type (void);
+static GType test_iface5_get_type (void);
+
#define TEST_TYPE_IFACE1 (test_iface1_get_type ())
#define TEST_TYPE_IFACE2 (test_iface2_get_type ())
#define TEST_TYPE_IFACE3 (test_iface3_get_type ())
* construct properties, signals and implementing an interface.
*************************************************************/
+static GType complex_object_get_type (void);
#define COMPLEX_TYPE_OBJECT (complex_object_get_type ())
typedef struct _ComplexObject ComplexObject;
typedef struct _ComplexObjectClass ComplexObjectClass;
COMPLEX_SIGNAL_EMPTY,
COMPLEX_SIGNAL_GENERIC,
COMPLEX_SIGNAL_GENERIC_EMPTY,
+ COMPLEX_SIGNAL_ARGS,
COMPLEX_LAST_SIGNAL
};
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",
struct ConstructionTest *data;
data = g_new0 (struct ConstructionTest, 1);
- data->type = ((GType (*)())test->extra_data)();
+ data->type = ((GType (*)(void))test->extra_data)();
return data;
}
}
/*************************************************************
- * Test signal unhandled emissions performance
+ * Test signal emissions performance (common code)
*************************************************************/
#define NUM_EMISSIONS_PER_ROUND 10000
int signal_id;
};
+static void
+test_emission_run (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);
+}
+
+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
+ *************************************************************/
+
static gpointer
test_emission_unhandled_setup (PerformanceTest *test)
{
}
static void
-test_emission_unhandled_run (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);
-}
-
-static void
test_emission_unhandled_finish (PerformanceTest *test,
gpointer data)
{
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;
}
}
static void
-test_emission_handled_run (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);
-}
-
-static void
test_emission_handled_finish (PerformanceTest *test,
gpointer data)
{
GINT_TO_POINTER (COMPLEX_SIGNAL),
test_emission_unhandled_setup,
test_emission_unhandled_init,
- test_emission_unhandled_run,
+ test_emission_run,
test_emission_unhandled_finish,
test_emission_unhandled_teardown,
test_emission_unhandled_print_result
GINT_TO_POINTER (COMPLEX_SIGNAL_EMPTY),
test_emission_unhandled_setup,
test_emission_unhandled_init,
- test_emission_unhandled_run,
+ test_emission_run,
test_emission_unhandled_finish,
test_emission_unhandled_teardown,
test_emission_unhandled_print_result
GINT_TO_POINTER (COMPLEX_SIGNAL_GENERIC),
test_emission_unhandled_setup,
test_emission_unhandled_init,
- test_emission_unhandled_run,
+ test_emission_run,
test_emission_unhandled_finish,
test_emission_unhandled_teardown,
test_emission_unhandled_print_result
GINT_TO_POINTER (COMPLEX_SIGNAL_GENERIC_EMPTY),
test_emission_unhandled_setup,
test_emission_unhandled_init,
- test_emission_unhandled_run,
+ test_emission_run,
+ test_emission_unhandled_finish,
+ test_emission_unhandled_teardown,
+ 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
GINT_TO_POINTER (COMPLEX_SIGNAL),
test_emission_handled_setup,
test_emission_handled_init,
- test_emission_handled_run,
+ test_emission_run,
test_emission_handled_finish,
test_emission_handled_teardown,
test_emission_handled_print_result
GINT_TO_POINTER (COMPLEX_SIGNAL_EMPTY),
test_emission_handled_setup,
test_emission_handled_init,
- test_emission_handled_run,
+ test_emission_run,
test_emission_handled_finish,
test_emission_handled_teardown,
test_emission_handled_print_result
GINT_TO_POINTER (COMPLEX_SIGNAL_GENERIC),
test_emission_handled_setup,
test_emission_handled_init,
- test_emission_handled_run,
+ test_emission_run,
test_emission_handled_finish,
test_emission_handled_teardown,
test_emission_handled_print_result
GINT_TO_POINTER (COMPLEX_SIGNAL_GENERIC_EMPTY),
test_emission_handled_setup,
test_emission_handled_init,
- test_emission_handled_run,
+ test_emission_run,
+ 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
GError *error = NULL;
int i;
- g_type_init ();
-
context = g_option_context_new ("GObject performance tests");
g_option_context_add_main_entries (context, cmd_entries, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error))