Sections
Timeline
Browse Source
View Tickets
New Ticket
Sub-Sections
Start Page
Index
History
Last Change
Download
Plain Text
Metanav
Preferences
About Trac
Links
Slowchop Studios
Gerald Kaszuba
Advertisement

Documentation

This applies to pycallgraph v0.5.0. To see other versions go here.

Installation

Command-Line Usage

Create a call graph called pycg.png on myprogram.py:

pycg ./myprogram.py

Create a call graph of a standard Python installation script with command line parameters:

pycg --output-file=setup.png -- setup.py --dry-run install

Only see the module "distutils" within the execution of easy_install:

pycg --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
pycallgraph.start_trace()

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

pycallgraph.make_dot_graph('test.png')

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')