From ab10ae902d8aa7c2b98fd080a7458127b1b8e648 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 11 May 2003 07:59:08 +0000 Subject: 2003-05-11 Havoc Pennington Write a "test-profile" that does echo client-server with threads; profile reveals lock contention, memcpy/realloc of buffers, and UTF-8 validation as hot spots. 20% of lock contention eliminated with dbus_atomic_inc/dec implementation on x86. Much remaining contention is global mempool locks for GList and DBusList. * dbus/dbus-sysdeps.c (_dbus_atomic_inc, _dbus_atomic_dec): add x86 implementation * dbus/dbus-connection.c (struct DBusConnection): use dbus_atomic_t for the reference count * dbus/dbus-message.c (struct DBusMessage): declare dbus_atomic_t values as volatile * configure.in: code to detect ability to use atomic integer operations in assembly, from GLib patch * dbus/dbus-internals.c (_dbus_verbose_real): call getpid every time, tired of it being wrong in threads and forked processes * glib/test-profile.c: a little program to bounce messages back and forth between threads and eat CPU * dbus/dbus-connection.c: add debug spew macros for debugging thread locks; include config.h at top; fix deadlock in dbus_connection_flush() --- dbus/dbus-internals.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'dbus/dbus-internals.c') diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 25bd52ba..6a091e62 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -190,7 +190,6 @@ _dbus_verbose_real (const char *format, { va_list args; static dbus_bool_t verbose = TRUE; - static unsigned long pid; /* things are written a bit oddly here so that * in the non-verbose case we just have the one @@ -202,13 +201,12 @@ _dbus_verbose_real (const char *format, if (!verbose_initted) { verbose = _dbus_getenv ("DBUS_VERBOSE") != NULL; - pid = _dbus_getpid (); verbose_initted = TRUE; if (!verbose) return; } - fprintf (stderr, "%lu: ", pid); + fprintf (stderr, "%lu: ", _dbus_getpid ()); va_start (args, format); vfprintf (stderr, format, args); -- cgit