mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-22 21:58:09 +02:00
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()
55 lines
No EOL
1.2 KiB
Makefile
55 lines
No EOL
1.2 KiB
Makefile
INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS)
|
|
|
|
dbusincludedir=$(includedir)/dbus-1.0/dbus
|
|
|
|
lib_LTLIBRARIES=libdbus-glib-1.la
|
|
|
|
dbusinclude_HEADERS= \
|
|
dbus-glib.h
|
|
|
|
libdbus_glib_1_la_SOURCES = \
|
|
dbus-gmain.c \
|
|
dbus-gthread.c
|
|
|
|
libdbus_glib_1_la_LIBADD= $(DBUS_GLIB_LIBS) $(top_builddir)/dbus/libdbus-1.la
|
|
|
|
if DBUS_BUILD_TESTS
|
|
|
|
if HAVE_GLIB_THREADS
|
|
THREAD_APPS=test-thread-server test-thread-client test-profile
|
|
|
|
test_thread_server_SOURCES= \
|
|
test-thread-server.c \
|
|
test-thread.h
|
|
|
|
test_thread_server_LDADD= $(DBUS_GLIB_THREADS_LIBS) $(top_builddir)/glib/libdbus-glib-1.la
|
|
|
|
test_thread_client_SOURCES= \
|
|
test-thread-client.c \
|
|
test-thread.h
|
|
|
|
test_thread_client_LDADD= $(DBUS_GLIB_THREADS_LIBS) $(top_builddir)/glib/libdbus-glib-1.la
|
|
endif
|
|
|
|
noinst_PROGRAMS= test-dbus-glib $(THREAD_APPS)
|
|
|
|
test_dbus_glib_SOURCES= \
|
|
test-dbus-glib.c
|
|
|
|
test_dbus_glib_LDADD= $(top_builddir)/glib/libdbus-glib-1.la
|
|
|
|
else
|
|
### not building tests
|
|
|
|
if HAVE_GLIB_THREADS
|
|
noinst_PROGRAMS=test-profile
|
|
endif
|
|
|
|
endif
|
|
|
|
if HAVE_GLIB_THREADS
|
|
test_profile_SOURCES= \
|
|
test-profile.c
|
|
|
|
test_profile_LDADD= $(DBUS_GLIB_THREADS_LIBS) $(top_builddir)/glib/libdbus-glib-1.la
|
|
endif |