Hi,<br><br> I want to use D-Bus as communication mechanism between processes. But I am not sure if it can work effectually on my PXA310(ARM, about 600MHz), so I did some performance test as follows:<br>1.<br> Use socket to carry data form a process(client) to another process(server):
<br> client.c:<br> gettimeofday()<br> write() /* write 100 bytes data */<br> server.c:<br> read() /* read 100 bytes data */<br> gettimeofday()<br> The interval between the two gettimeofday() is about 180 microseconds.
<br><br>2.<br> Use D-Bus(Ver 1.0.2) to do a remote method call(peer-to-peer):<br> client.c:<br> main()<br> {<br> dbus_connection_open (CONNECTION_ADDRESS, &error);<br><br>
dbus_message_new_method_call()<br> dbus_connection_send_with_reply_and_block()<br><br> gettimeofday()<br> dbus_message_new_method_call()<br> dbus_message_append_args() /* append 100 bytes data as input parameter */
<br> dbus_connection_send_with_reply_and_block() /* */<br> dbus_message_get_args() /* it will get 100 bytes data as output parameter */<br> gettimeofday()<br> }<br>
server.c:<br> main()<br> {<br> server = dbus_server_listen (CONNECTION_ADDRESS, &error);<br> dbus_server_setup_with_g_main (server, NULL);<br> dbus_server_set_new_connection_function (server, new_connection_func, NULL, NULL);
<br> g_main_loop_run()<br> }<br> new_connection_func()<br> {<br> server_conn_ptr = dbus_connection_ref (conn);<br> dbus_connection_setup_with_g_main( server_conn_ptr, NULL );
<br> dbus_connection_add_filter( server_conn_ptr, dbus_filter, loop, NULL );<br> }<br> dbus_filter()<br> {<br> /* handle & response the remote method call */
<br> }<br> The interval between the two gettimeofday() is about 4200 microseconds! (I tried about ten thousands, the value is quite consistent)<br><br> As you can see, compared with socket, D-Bus is much slower. But the FAQ says D-Bus one-to-one communication was about
2.5x slower than simply pushing the data raw over a socket. So there must be some mistakes in my test program. I hope someone can help me. Many thanks!<br><br>