Thursday September 08, 2005 | Artem's Weblog |
|
Free Code Graphing Project was an attempt to visualize Linux kernel source code. Now that Solaris is free code, too, why not try to graph it. This blog entry describes my little effort of debugging the thing into existence. I can't afford to spend any more time on this, so hopefully someone picks the baton. The end result is a huge PostScript file that looks like this:
Sample close-up, common/vm/seg_kmem.c:
Roughly, the algorithm used:
Here's how rings are defined for Linux: RING1:=init lib mm kernel ipc RING2:=net fs RING3:=$(subst $(KERNEL_DIR)/,,$(wildcard $(KERNEL_DIR)/arch/*)) RING4:=drivers crypto sound security Solaris has a bit different directory structure. Here's what I used: RING1:=common/os common/vm common/c2 common/cpr common/disp common/dtrace common/exec common/krtld common/syscall RING2:=common/fs common/inet common/ipp common/ktli common/rpc RING3:=i86pc sparc sun sun4 sun4u sun4v RING4:=common/io Steps to make it work in Solaris 1. Prerequisites:
2. Set you KERNEL_DIR environment variable to usr/src/uts subdirectory of OpenSolaris source, e.g.: KERNEL_DIR=$HOME/solgraph/usr/src/uts; export KERNEL_DIR 3. Preprocess OpenSolaris code, since the fcgp parser does not like Solaris coding style (ignore warnings):
chmod -R +w $KERNEL_DIR
find $KERNEL_DIR -name '*.c' -exec indent -npsl {} \;
4. Modify your path to look in /usr/xpg4/bin first: Alternatively you can replace all 'tail -n number' occurences in fcgp scripts with 'tail -number', but it's easier to just use /usr/xpg4/bin/tail. PATH=/usr/xpg4/bin:$PATH; export PATH 5. If using X, turn off the bell. Fcgp spits out some escape sequences that would drive you nuts (they might not look pretty on some terminals either): xset -b 6. Kick off the build process. Takes about 9 minutes on my Ferrari 3400. cd lgp-2.6.0a-solaris gmake CC=gcc 7. Generate viewable/printable postscript files. Examples for a single file and for a 6x6 poster: ./posterize a4 1 ./posterize a4 6 See README for more information on printing and assembling a poster. To do list
I won't have time for these in the next two months, so feel free to pick up where I left. I can be reached at artem dot kachitchkin at sun dot com. Tags:
Solaris
OpenSolaris
Trackback URL: http://blogs.sun.com/artem/entry/graphing_the_solaris_kernel
Post a Comment: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Posted by Dan Price on September 09, 2005 at 01:22 AM PDT #
Posted by Kanat on December 16, 2005 at 11:32 PM PST #