hi all <br><br>conn = dbus_bus_get (DBUS_BUS_SESSION, &derror);<br> if (!conn)<br> lose ("Cannot get connection: %s", derror.message);<br> g_print ("(expecting assertion...)\n");<br> gconn = dbus_connection_get_g_connection (conn);<br>
if (gconn)<br> lose ("Retrieved DBusGConection from plain DBusConnection");<br><br><br> /* Check DBusGConnection -> DBusConnection -> DBusGConnection */<br> gconn = dbus_g_bus_get (DBUS_BUS_SESSION, &gerror);<br>
if (!gconn)<br> lose ("Cannot get connection: %s", gerror->message);<br> <br> conn = dbus_g_connection_get_connection (gconn);<br> if (!conn)<br> lose ("Cannot get DBusConnection from DBusGConnection");<br>
<br> gconn2 = dbus_connection_get_g_connection (conn);<br><br><br>this is the portion of code where i hav problem .. here when i am comparing the gonn ?& gcoon2 i see that both doesnt match as i see that gconn2 alwaqys returns 0...any inputs on this will be a great help 4 me <br>
<br><br>thanx in advance <br>vasanth <br><br><br><div class="gmail_quote">On Wed, Jun 11, 2008 at 11:00 AM, Kalle Vahlman <<a href="mailto:kalle.vahlman@gmail.com">kalle.vahlman@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2007/10/25 Havoc Pennington <<a href="mailto:hp@redhat.com">hp@redhat.com</a>>:<br>
> Hi,<br>
><br>
> Kalle Vahlman wrote:<br>
>><br>
>> I'm not sure if the D-Bus daemon already has such logging facilities,<br>
>> but storing information on the amount of messages, average/peak sizes<br>
>> of payloads and identifying who sends how much during regural daily<br>
>> usage should be very interesting to chart.<br>
>><br>
><br>
> Indeed. This is most likely very simple: an easy approach would be to hack<br>
> the daemon to send a signal message out whenever the data changes, then have<br>
> a little app that connects to dbus and gets these messages. The only trick<br>
> is, don't count the signals themselves ;-)<br>
<br>
This has been sitting in my inbox as a TODO for quite some time and<br>
few weeks ago I went ahead and hacked something up. Then got busy etc.<br>
but now the code is available at<br>
<br>
<a href="http://gitweb.pingu.fi/?p=dbus.git;a=summary" target="_blank">http://gitweb.pingu.fi/?p=dbus.git;a=summary</a><br>
<br>
There's two new things in the repo (both controlled by the --enable<br>
option for configure):<br>
<br>
In libdbus there now is a trivial traffic logging support by recording<br>
data from DBusMessages into a file. This is public API with log domain<br>
support so you could use it in whatever application you want to for<br>
recording messages for traffic profiling.<br>
<br>
And then there's the dbus-daemon portion which records all outgoing<br>
messages using the above system. I decided that this would be the most<br>
interesting data to start with, as it includes _all_ delivered<br>
messages even when there are multiple recipients. Of course it doesn't<br>
record the incoming messages that don't have a recipient but that's<br>
for another day.<br>
<br>
The data recorded is as follows:<br>
<br>
domain ; sender ; destination ; message type ; signature ; size(bytes)<br>
; sha-1 of message body ; message timestamp (seconds from epoch)<br>
<br>
Obviously, this means sha-1 calculations for each message recorded as<br>
well as disc access so it definitely will degrade performance :) The<br>
uniqueness of a message is an important factor though, so I think it<br>
is worth it. It's not like this code is intended to run on production<br>
systems anyway ;)<br>
<br>
The profiling has two enviromental variables:<br>
- DBUS_TRAFFIC_PROFILING for enabling/disabling the profiling (set/unset)<br>
- DBUS_TRAFFIC_PROFILING_LOG for controlling where to write the file<br>
<br>
Let me know if I've done something silly in the code. I've been<br>
running it on my N800 for a while and last night set up my desktop<br>
machine to do the same, so at least it works to some degree.<br>
<br>
Haven't had time to really analyze the data, but seems like the<br>
average message size (in system bus at least) is pretty small and the<br>
bus is not so active as one might think given the impression that<br>
"everything" uses D-Bus. There were some peaks though and seems like<br>
the system bus is more active so it should be interesting to see what<br>
happens there too.<br>
<font color="#888888"><br>
--<br>
Kalle Vahlman, <a href="mailto:zuh@iki.fi">zuh@iki.fi</a><br>
Powered by <a href="http://movial.fi" target="_blank">http://movial.fi</a><br>
Interesting stuff at <a href="http://syslog.movial.fi" target="_blank">http://syslog.movial.fi</a><br>
_______________________________________________<br>
dbus mailing list<br>
<a href="mailto:dbus@lists.freedesktop.org">dbus@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dbus" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dbus</a><br>
</font></blockquote></div><br>