From 568e60e182a267ccc375c56e39aa9de21d0bcbcb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 28 Mar 2012 22:52:36 -0500 Subject: Insert callgrind annotations into the server --- tests/test-json-server.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests/test-json-server.c') diff --git a/tests/test-json-server.c b/tests/test-json-server.c index 083de60..6a53aec 100644 --- a/tests/test-json-server.c +++ b/tests/test-json-server.c @@ -22,6 +22,7 @@ with this program. If not, see . #include #include +#include "callgrind.h" #include #include @@ -32,6 +33,9 @@ static GMainLoop * mainloop = NULL; static gboolean timer_func (gpointer data) { + g_debug("Dumping callgrind data"); + CALLGRIND_DUMP_STATS_AT("exported"); + CALLGRIND_STOP_INSTRUMENTATION; g_main_loop_quit(mainloop); return FALSE; } @@ -50,9 +54,13 @@ on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) return; } + g_debug("Starting Callgrind"); + CALLGRIND_START_INSTRUMENTATION; + CALLGRIND_ZERO_STATS; + CALLGRIND_TOGGLE_COLLECT; dbusmenu_server_set_root(server, root); - g_timeout_add(10000, timer_func, NULL); + g_timeout_add_seconds(100, timer_func, NULL); return; } -- cgit v1.2.3 From 7d376ec5570f6732f90a52e7fc448285c80c5ddb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 28 Mar 2012 23:13:48 -0500 Subject: Making the json test signal based instead of timeout based --- tests/test-json-server.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/test-json-server.c') diff --git a/tests/test-json-server.c b/tests/test-json-server.c index 6a53aec..7165838 100644 --- a/tests/test-json-server.c +++ b/tests/test-json-server.c @@ -30,14 +30,14 @@ with this program. If not, see . static GMainLoop * mainloop = NULL; -static gboolean -timer_func (gpointer data) +static void +root_activate (void) { g_debug("Dumping callgrind data"); CALLGRIND_DUMP_STATS_AT("exported"); CALLGRIND_STOP_INSTRUMENTATION; g_main_loop_quit(mainloop); - return FALSE; + return; } static void @@ -54,14 +54,14 @@ on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) return; } + g_signal_connect(G_OBJECT(root), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(root_activate), NULL); + g_debug("Starting Callgrind"); CALLGRIND_START_INSTRUMENTATION; CALLGRIND_ZERO_STATS; CALLGRIND_TOGGLE_COLLECT; dbusmenu_server_set_root(server, root); - g_timeout_add_seconds(100, timer_func, NULL); - return; } -- cgit v1.2.3