Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
doc:codeviz [2008/11/18 13:43] mdc created |
doc:codeviz [2008/11/19 08:25] (current) mdc |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Codeviz installation ====== | ====== Codeviz installation ====== | ||
- | ===== Website ===== | + | ===== Background ===== |
+ | |||
+ | When trying to understand what code does, it is often useful to create a graphical representation that shows how functions call each other. This kind of representation is often called a //call graph//. | ||
+ | |||
+ | Codeviz is a tool that helps create call graphs. | ||
+ | |||
+ | ===== Author's Website ===== | ||
+ | |||
+ | I downloaded codeviz from this website: http://www.csn.ul.ie/~mel/projects/codeviz/ | ||
+ | |||
+ | ===== Example call graph ===== | ||
+ | |||
+ | Here is an example of a call graph for a function in gPXE: | ||
+ | |||
+ | {{:doc:rtl8169_process_rx_packets.png?800|call graph example}} | ||
+ | |||
+ | The function name is in the rectangular box on the left, and all the functions that are called flow to the right. I have limited the display to 3 levels of depth for presentation purposes. | ||
- | http://www.csn.ul.ie/~mel/projects/codeviz/ | ||
===== Installation Procedure ===== | ===== Installation Procedure ===== | ||
Line 54: | Line 69: | ||
===== Creating nice call graphs ===== | ===== Creating nice call graphs ===== | ||
- | To make a nice call graph of ''rtl_open for instance'', we can do: | + | To make a nice call graph of ''rtl8169_poll for instance'', we can do: |
$ gengraph -f rtl8169_poll -d 3 output-font=Arial --output-layout LR --plain | $ gengraph -f rtl8169_poll -d 3 output-font=Arial --output-layout LR --plain | ||
- | This does a call graph of the function rtl8169_open, depth 3, left-to-right orientation, and requests that output be saved for input to the ''dot'' program. | + | This does a call graph of the function rtl8169_poll, depth 3, left-to-right orientation, and requests that output be saved for input to the ''dot'' program. |
''dot'' is the program that renders the outupt from gengraph: | ''dot'' is the program that renders the outupt from gengraph: | ||
- | $ dot -Gcenter=1 -Gsize=11,8.5 -Gmargin=.333 -Tps -o rtl8169_poll.ps < rtl8169_poll.plain | + | $ dot -GPAPERSIZE=letter -Gsize=8,10.5 -Gcenter=1 -Gmargin=.25 -Tps -o rtl8169_poll.ps < rtl8169_poll.plain |
- | ''dot'' draw the call graph according to the instructions in the ''.plain'' file, and outputs a file in whatever -T says (postscript in this case. png is also popular). | + | ''dot'' draws the call graph according to the instructions in the ''.plain'' file, and outputs a file in whatever -T says (postscript in this case. png is also popular). |
We can also request a ''.pdf'' be created from the ''.ps'' file using ''ps2pdf'': | We can also request a ''.pdf'' be created from the ''.ps'' file using ''ps2pdf'': | ||
- | $ ps2pdf rtl_poll.ps | + | $ ps2pdf rtl8169_poll.ps |
===== Automating the process ===== | ===== Automating the process ===== | ||