Free Code Graphing Project - Details

About
Implementation/Development notes
Implementation details
Screenshots
Changelog
Sourceforge Project Page

The process goes like so:

  1. For each "ring" (lib/mm/kernel/init/ipc, net/fs, arch & drivers):
    1. 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)
    2. Create a pipe: rmclutter -> extractfuncs.pl -> function2ps . For each source (.c) file from the kernel tree this:
      1. (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.
      2. (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 ...
      3. (function2ps), which analyzes them, generates postscript and writes that into separate files ("CFilename.functionname.+Classification+.ps").
  2. 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.:
    1. 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.
    2. Read the names of the function files from stdin, generate a list of function names and their filenames.
    3. For each start letter of a function ([A-Za-z_]):
      1. Build a regex matching all functions starting with that letter
      2. Use that regex to grep over the (filtered) kernel sources to find all "hot candidate" lines
      3. For each function starting with that letter:
        1. Look through the "hot candidates" to classify the func
        2. Rename all function files for this function name to show the updated classification
  3. Then we enter stage II: creating the Postscript. We create an image/ subdirectory.
  4. First thing we do in run gen_makefile.sh to generate a Makefile in the image/ dir, now we know what functions exist.
  5. Then we cd into the image/ dir and do a make. This does the following:
    1. 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.
    2. 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.
    3. Rings II and III, which have multiple sectors, are assembled using rotary_arrange.sh.
    4. Once the rings are done, we draw the black outline demarking them, with the labels on it.
    5. Then we paste the rings together with the key, the title, logo, author and the outline generated above, to give image/image.ps.
  6. Finally, we create a symlink called "image.ps" into the image directory.
  7. 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

SourceForge Logo