/bits&bytes, /coding

[Python] Klassen Diagramm pyCallGraph

pycallgraph is a Python module that creates call graphs for Python programs.

Download from pycallgraph site

extract it, change in the folder. Execute easy_install

#easy_install pycallgraph

Create a call graph called pycallgraph.png on myprogram.py:
#pycallgraph ./myprogram.py

Create a call graph of a standard Python installation script with command line parameters:
#pycallgraph –output-file=setup.png — setup.py –dry-run install

Only see the module „distutils“ within the execution of easy_install:
#pycallgraph –include=distutils.* /usr/bin/easy_install

Module Usage

You may import pycallgraph as a module and run the trace graph within your application. Just before your first line of code you want to graph, put in the following code:
import pycallgraph

To stop the trace and generate the graph, put in the following code (usually at the end of your program):

The default is to output in png with with the dot tool. You can change them by specifying arguments:
pycallgraph.make_dot_graph(‚test.jpg‘, format=’jpg‘, tool=’neato‘)


Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s