aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-28 22:52:36 -0500
committerTed Gould <ted@gould.cx>2012-03-28 22:52:36 -0500
commit568e60e182a267ccc375c56e39aa9de21d0bcbcb (patch)
tree4f90491a6282d496725d894856a81c343bffb948
parent7c40935a7aceea140f34248ee11b61d08f381263 (diff)
downloadlibdbusmenu-568e60e182a267ccc375c56e39aa9de21d0bcbcb.tar.gz
libdbusmenu-568e60e182a267ccc375c56e39aa9de21d0bcbcb.tar.bz2
libdbusmenu-568e60e182a267ccc375c56e39aa9de21d0bcbcb.zip
Insert callgrind annotations into the server
-rw-r--r--configure.ac3
-rw-r--r--tests/test-json-server.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 42c5b3d..04c93e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,7 +118,8 @@ AM_CONDITIONAL([WANT_TESTS], [test "x$enable_tests" != "xno"])
AS_IF([test "x$enable_tests" != "xno"],[
PKG_CHECK_MODULES(DBUSMENUTESTS, json-glib-1.0 >= $JSON_GLIB_REQUIRED_VERSION
- gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION,
+ gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
+ valgrind,
[have_tests=yes]
)
])
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 <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>
@@ -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;
}