aboutsummaryrefslogtreecommitdiff
path: root/tests/test-json-server.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-03-29 11:34:08 -0700
committerCharles Kerr <charles.kerr@canonical.com>2012-03-29 11:34:08 -0700
commite58eb9f420b0ea6b4830f78027dfddc5a28ec46d (patch)
tree2b364913f9e73bd88da7f507c4658072e68d1996 /tests/test-json-server.c
parent73a2c824dc830cef9577f0993e83bd699fa60362 (diff)
parentbc392e208fa1f9b46c77ea8142dadd629722663a (diff)
downloadlibdbusmenu-e58eb9f420b0ea6b4830f78027dfddc5a28ec46d.tar.gz
libdbusmenu-e58eb9f420b0ea6b4830f78027dfddc5a28ec46d.tar.bz2
libdbusmenu-e58eb9f420b0ea6b4830f78027dfddc5a28ec46d.zip
* New upstream release.
* Faster menuitem lookups (LP: #801699) * To reduce dbus traffic, only send event replies when the caller requests them * Added support for callgrind-based benchmarks * Minor code cleanup
Diffstat (limited to 'tests/test-json-server.c')
-rw-r--r--tests/test-json-server.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/test-json-server.c b/tests/test-json-server.c
index 083de60..7165838 100644
--- a/tests/test-json-server.c
+++ b/tests/test-json-server.c
@@ -22,6 +22,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib.h>
#include <gio/gio.h>
+#include "callgrind.h"
#include <libdbusmenu-glib/server.h>
#include <libdbusmenu-glib/menuitem.h>
@@ -29,11 +30,14 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
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
@@ -50,9 +54,13 @@ on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data)
return;
}
- dbusmenu_server_set_root(server, root);
+ g_signal_connect(G_OBJECT(root), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(root_activate), NULL);
- g_timeout_add(10000, timer_func, NULL);
+ g_debug("Starting Callgrind");
+ CALLGRIND_START_INSTRUMENTATION;
+ CALLGRIND_ZERO_STATS;
+ CALLGRIND_TOGGLE_COLLECT;
+ dbusmenu_server_set_root(server, root);
return;
}