dbus/test/glib test-profile.c,1.9,1.10

Havoc Pennington hp at freedesktop.org
Thu Nov 25 22:22:55 PST 2004


Update of /cvs/dbus/dbus/test/glib
In directory gabe:/tmp/cvs-serv28645/test/glib

Modified Files:
	test-profile.c 
Log Message:
2004-11-26  Havoc Pennington  <hp at 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



Index: test-profile.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-profile.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- test-profile.c	26 Nov 2004 01:53:13 -0000	1.9
+++ test-profile.c	26 Nov 2004 06:22:53 -0000	1.10
@@ -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 @@
       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 @@
     }
 
 #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 @@
     }
 
 #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 @@
       ++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 @@
       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);
     }



More information about the dbus-commit mailing list