Free Code Graphing Project - Details
Sourceforge Project Page
The process goes like so:
- For each "ring" (lib/mm/kernel/init/ipc, net/fs, arch & drivers):
- Use setup_dirtree.pl to setup the neccessary directory structure
in image/ and to create image/ringX-files* (lists of the source
files in this ring)
- Create a pipe: rmclutter -> extractfuncs.pl -> function2ps . For
each source (.c) file from the kernel tree this:
- (rmclutter) removes comments, preprocessor directives, string
constants (though preserving the quotes so that analyze_function
can later recognize them as string constants) etc. That makes it
a bit easier for the following stages.
- (extract_funcs.pl) finds individual functions larger than
a certain size, classifies them into STATIC, INDIRECT (called
through pointer) or NONSTATIC and dumps them out as NUL-separated
stream to ...
- (function2ps), which analyzes them, generates postscript
and writes that into separate files
- Then use classify_nonstatics.pl to classify all the NONSTATIC
functions into EXPORTED (exported to modules using
EXPORT_SYMBOL), INDIRECT (called through pointer) or NORMAL.:
- Read the entire kernel source tree into memory (again using
rmclutter.lex plus some further filtering to save space &
make things simpler), organizing it in a hashmap.
- Read the names of the function files from stdin, generate a
list of function names and their filenames.
- For each start letter of a function ([A-Za-z_]):
- Build a regex matching all functions starting with that
- Use that regex to grep over the (filtered) kernel sources
to find all "hot candidate" lines
- For each function starting with that letter:
- Look through the "hot candidates" to classify the func
- Rename all function files for this function name to
show the updated classification
- Then we enter stage II: creating the Postscript. We create an
- First thing we do in run gen_makefile.sh to generate a Makefile
in the image/ dir, now we know what functions exist.
- Then we cd into the image/ dir and do a make. This does the
- The functions in each file are labelled and combined back
into a PostScript image of the whole file, using
conglomerate_functions.pl, which puts a dashed bounding box
and label on each function, then calls draw_arrangement.c to
arrange them into a glob, which gets a solid bounding box and
the filename attached.
- The files are then rendered into sectors, according to
the ring, using draw_arrangement.c again. The inner ring has
all the files in the ipc, kernel, lib, mm and init dirs all
piled together. The second ring has two segments: the fs/
segment and the net/ segment. The third ring has one segment
per architecture, and the final ring has all the drivers piled
together. The layout algorithm is inner to outer, smallest to
largest, with an iterative spacing increase if there is too
much gap in the outer ring.
- Rings II and III, which have multiple sectors, are
assembled using rotary_arrange.sh.
- Once the rings are done, we draw the black outline
demarking them, with the labels on it.
- Then we paste the rings together with the key, the title,
logo, author and the outline generated above, to give
- Finally, we create a symlink called "image.ps" into the image
- To create a nicely bounded PS compliant image, the "posterize"
shell script can be used (and trivially hacked), which uses the
bounding box information at the bottom of the PostScript file
(I keep this uptodate through all the steps).
Last Change: 2001-08-18 05:37:25 UTC