How to make a D-Bus diagram with DBusMessagesBox.py
I started a page for my DBusMessagesBox.py tool. So now you can generate beautiful D-Bus diagrams like this one:

I started a page for my DBusMessagesBox.py tool. So now you can generate beautiful D-Bus diagrams like this one:

The Telepathy framework has a lot of components. It may be hard to understand the dependencies. I discovered Debtree and used it to generate dependency graphs:

The command line was:
debtree -r --condense --no-conflicts --no-recommends --no-alternatives --no-provides empathy > empathy.dot
dot -Tpng -o empathy.png empathy.dot
With this configuration: ~/.debtree/skiplist ~/.debtree/endlist
“The dbus-monitor command is used to monitor messages going through a D-Bus message bus” (manpage). But when there is several connections on the bus and lots of method calls and signals, the output is not easily readable. Sometimes I draw a diagram on a piece of paper: it helps me to understand what happens. But it would be better to have diagrams drawn automatically.
This can be achieved with Mscgen (patched to draw D-Bus signals) and some scripts. Mscgen is a simple tool to generate diagrams from a simple text file with a simple syntax. Text files can be put in a SCM.
I wrote a python script that listens on the bus and writes the .msc file.
Example with Quod Libet:

Example with Telepathy:

The python script has a DBusMessagesBox object. I can filter D-Bus connection I don’t want to draw. In this example, I don’t print messages from or to the script itself. I can filter message from or to the dbus-daemon.
The script choose the right name (”salut” instead of “:1.15″). Some programs requests several connection names on the session bus. In this case, you can choose the prefered name with the ‘prefered_names’ option.
#skip_entities = set(“DBusMessagesBox”, “DBus”) skip_entities = set(“DBusMessagesBox”) options = { ’skip_entities’ : skip_entities, \ ‘prefered_names’ : ‘gabble’, ’salut’, ‘ChatFilter’ }
box = DBusMessagesBox(options) box.start_recording() try: gtk.main() except: print
box.stop_recording()
box.parse("/tmp/file.msc") os.system("mscgen -T png -i /tmp/file.msc -o /tmp/file.png")
Powered by WordPress