summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2004-11-26 06:22:53 +0000
committerHavoc Pennington <hp@redhat.com>2004-11-26 06:22:53 +0000
commita58180de0e720f7fca46a5af69a7b27b5e102a1d (patch)
tree2338738f08cbda1e824756fd2efcc8883d197ddc /test
parentc670c23823a2f62a3bbb5867451f357d2b96c43d (diff)
2004-11-26 Havoc Pennington <hp@redhat.com>
* dbus/dbus-message.c (struct DBusMessage): put the locked bit and the "char byte_order" next to each other to save 4 bytes (dbus_message_new_empty_header): reduce preallocation, since the message cache should achieve a similar effect (dbus_message_cache_or_finalize, dbus_message_get_cached): add a message cache that keeps a few DBusMessage around in a pool, another 8% speedup or so. * dbus/dbus-dataslot.c (_dbus_data_slot_list_clear): new function
Diffstat (limited to 'test')
-rw-r--r--test/glib/test-profile.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/test/glib/test-profile.c b/test/glib/test-profile.c
index 64fa6377..9958b4e4 100644
--- a/test/glib/test-profile.c
+++ b/test/glib/test-profile.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* test-profile.c Program that does basic message-response for timing
*
- * Copyright (C) 2003 Red Hat Inc.
+ * Copyright (C) 2003, 2004 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
@@ -47,7 +47,8 @@
* higher in the profile the larger the number of threads.
*/
#define N_CLIENT_THREADS 1
-#define N_ITERATIONS 150000
+#define N_ITERATIONS 1500000
+#define N_PROGRESS_UPDATES 20
#define PAYLOAD_SIZE 30
#define ECHO_PATH "/org/freedesktop/EchoTest"
#define ECHO_INTERFACE "org.freedesktop.EchoTest"
@@ -139,9 +140,14 @@ client_filter (DBusConnection *connection,
cd->iterations += 1;
if (cd->iterations >= N_ITERATIONS)
{
- g_print ("Completed %d iterations\n", N_ITERATIONS);
+ g_printerr ("\nCompleted %d iterations\n", N_ITERATIONS);
g_main_loop_quit (cd->loop);
}
+ else if (cd->iterations % (N_ITERATIONS/N_PROGRESS_UPDATES) == 0)
+ {
+ g_printerr ("%d%% ", (int) (cd->iterations/(double)N_ITERATIONS * 100.0));
+ }
+
send_echo_method_call (connection);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -339,7 +345,7 @@ read_and_drop_on_floor (int fd,
}
#if 0
- g_print ("%p read %d bytes from fd %d\n",
+ g_printerr ("%p read %d bytes from fd %d\n",
g_thread_self(), bytes_read, fd);
#endif
}
@@ -378,7 +384,7 @@ write_junk (int fd,
}
#if 0
- g_print ("%p wrote %d bytes to fd %d\n",
+ g_printerr ("%p wrote %d bytes to fd %d\n",
g_thread_self(), bytes_written, fd);
#endif
}
@@ -482,7 +488,7 @@ plain_sockets_init_server (ServerData *sd)
++p;
}
- g_print ("Socket is %s\n", path);
+ g_printerr ("Socket is %s\n", path);
server->listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
@@ -579,9 +585,13 @@ plain_sockets_client_side_watch (GIOChannel *source,
cd->iterations += 1;
if (cd->iterations >= N_ITERATIONS)
{
- g_print ("Completed %d iterations\n", N_ITERATIONS);
+ g_printerr ("\nCompleted %d iterations\n", N_ITERATIONS);
g_main_loop_quit (cd->loop);
}
+ else if (cd->iterations % (N_ITERATIONS/N_PROGRESS_UPDATES) == 0)
+ {
+ g_printerr ("%d%% ", (int) (cd->iterations/(double)N_ITERATIONS * 100.0));
+ }
write_junk (fd, echo_call_size);
}