summaryrefslogtreecommitdiffstats
path: root/glib
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-05-12 02:44:45 +0000
committerHavoc Pennington <hp@redhat.com>2003-05-12 02:44:45 +0000
commitd4e80132af03363a2f861cfd611847ee8758aed9 (patch)
tree96b06426382cb0df1db9dd06cf6d0c5b837d7e30 /glib
parentab10ae902d8aa7c2b98fd080a7458127b1b8e648 (diff)
2003-05-11 Havoc Pennington <hp@pobox.com>
* dbus/dbus-marshal.c (_dbus_marshal_validate_arg): fix to avoid calling _dbus_marshal_validate_arg() for every byte in a byte array, etc. * dbus/dbus-message-handler.c: use atomic reference counting to reduce number of locks slightly; the global lock in here sucks * dbus/dbus-connection.c (_dbus_connection_update_dispatch_status_and_unlock): variant of update_dispatch_status that can be called with lock held; then use in a couple places to reduce locking/unlocking (dbus_connection_send): hold the lock over the whole function instead of acquiring it twice. * dbus/dbus-timeout.c (_dbus_timeout_new): handle OOM * bus/connection.c (bus_connections_setup_connection): fix access to already-freed memory. * dbus/dbus-connection.c: keep a little cache of linked list nodes, to avoid using the global linked list alloc lock in the normal send-message case. Instead we just use the connection lock that we already have to take. * dbus/dbus-list.c (_dbus_list_find_last): new function * dbus/dbus-sysdeps.c (_dbus_atomic_inc, _dbus_atomic_dec): change to use a struct for the atomic type; fix docs, they return value before increment, not after increment. * dbus/dbus-string.c (_dbus_string_append_4_aligned) (_dbus_string_append_8_aligned): new functions to try to microoptimize this operation. (reallocate_for_length): break this out of set_length(), to improve profile info, and also so we can consider inlining the set_length() part. * dbus/dbus-message.c (dbus_message_new_empty_header): init data strings with some preallocation, cuts down on our calls to realloc a fair bit. Though if we can get the "move entire string to empty string" optimization below to kick in here, it would be better. * dbus/dbus-string.c (_dbus_string_move): just call _dbus_string_move_len (_dbus_string_move_len): add a special case for moving an entire string into an empty string; we can just swap the string data instead of doing any reallocs. (_dbus_string_init_preallocated): new function
Diffstat (limited to 'glib')
-rw-r--r--glib/test-profile.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/glib/test-profile.c b/glib/test-profile.c
index 6173f3a5..d53f7626 100644
--- a/glib/test-profile.c
+++ b/glib/test-profile.c
@@ -27,9 +27,11 @@
#include <stdlib.h>
#define N_CLIENT_THREADS 1
-#define N_ITERATIONS 2000
+#define N_ITERATIONS 100
+#define PAYLOAD_SIZE 1000
#define ECHO_MESSAGE "org.freedesktop.DBus.Test.EchoProfile"
static const char *address;
+static unsigned char *payload;
static void
send_echo_message (DBusConnection *connection)
@@ -40,7 +42,12 @@ send_echo_message (DBusConnection *connection)
dbus_message_append_args (message,
DBUS_TYPE_STRING, "Hello World!",
DBUS_TYPE_INT32, 123456,
+#if 1
+ DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+ payload, PAYLOAD_SIZE,
+#endif
DBUS_TYPE_INVALID);
+
dbus_connection_send (connection, message, NULL);
dbus_message_unref (message);
dbus_connection_flush (connection);
@@ -63,12 +70,12 @@ client_filter (DBusMessageHandler *handler,
ECHO_MESSAGE))
{
*iterations += 1;
- send_echo_message (connection);
- if (*iterations > N_ITERATIONS)
+ if (*iterations >= N_ITERATIONS)
{
g_print ("Completed %d iterations\n", N_ITERATIONS);
exit (0);
}
+ send_echo_message (connection);
}
return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
@@ -95,7 +102,7 @@ thread_func (void *data)
exit (1);
}
- iterations = 0;
+ iterations = 1;
handler = dbus_message_handler_new (client_filter,
&iterations, NULL);
@@ -188,6 +195,7 @@ main (int argc, char *argv[])
}
address = dbus_server_get_address (server);
+ payload = g_malloc (PAYLOAD_SIZE);
dbus_server_set_new_connection_function (server,
new_connection_callback,