Christian Koch


Visualizing dmesg(8) as a graph

Mon February 17, 2014

I wrote a little script which lays out the output of dmesg(8) as a directed graph. It shows you what’s connected to what. The result looks something like this:

Naturally, you can’t read that. Click here to see the full image.

You’re looking at a visualization of dmesg(8) on NetBSD/i386 6.0.1 running on my Sony Vaio VGN-CR520E with a custom kernel configuration. I’m too lazy to make the script portable — it assumes device names smell like those on NetBSD. That would be the next step.

The script is written in Ruby. It spits out a minimal directed graph description in the DOT language, which you can then render as a PNG image.

$ ruby dmesg-graph.rb
$ dot -Tpng dmesg.dot > dmesg.png

Download dmesg-graph.rb.

Perhaps this tool could provide some insight into how your system is configured? Next, I’m going to run the tool on a machine running a GENERIC kernel. And then it might be interesting to do something similar on kernel config(5) files.

Assuming the script has no bugs (which it most certainly does), if two machines yield the same graph, then should the OS treat them as “identical” systems, whatever that may mean? Just a thought.

comments powered by Disqus