Module pycallgraph
source code
pycallgraph
U{http://pycallgraph.slowchop.com/}
Copyright Gerald Kaszuba 2007
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version:
0.4.1
Author:
Gerald Kaszuba
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tracer(frame,
event,
arg)
This is an internal function that is called every time a call is made
during a trace. |
source code
|
|
|
|
|
|
|
|
|
|
make_graph(filename,
format=None,
tool=None,
stop=None)
This has been changed to make_dot_graph. |
source code
|
|
|
|
make_dot_graph(filename,
format='png',
tool='dot',
stop=True)
Creates a graph using a Graphviz tool that supports the dot language. |
source code
|
|
|
|
|
Imports:
inspect,
sys,
os,
re,
tempfile,
time,
sysconfig
Resets all collected statistics. This is run automatically by
start_trace(reset=True) and when the module is loaded.
|
Returns True if the file_name is in the lib directory.
|
start_trace(reset=True,
filter_func=None,
time_filter_func=None)
| source code
|
Begins a trace. Setting reset to True will reset all previously recorded
trace data. filter_func needs to point to a callable function that accepts
the parameters (call_stack, module_name, class_name, func_name, full_name).
Every call will be passed into this function and it is up to the function
to decide if it should be included or not. Returning False means the call
will be filtered out and not included in the call graph.
|
Stops the currently running trace, if any.
|
This is an internal function that is called every time a call is made
during a trace. It keeps track of relationships between calls.
|
Returns a string containing a DOT file. Setting stop to True will cause
the trace to stop.
|
Generates a DOT file and writes it into filename.
|
make_graph(filename,
format=None,
tool=None,
stop=None)
| source code
|
This has been changed to make_dot_graph.
|
make_dot_graph(filename,
format='png',
tool='dot',
stop=True)
| source code
|
Creates a graph using a Graphviz tool that supports the dot language. It
will output into a file specified by filename with the format specified.
Setting stop to True will stop the current trace.
|
|
Simple memoization for functions without keyword arguments.
This is useful for mapping code objects to module in this context.
inspect.getmodule() requires a number of system calls, which may slow down
the tracing considerably. Caching the mapping from code objects (there is
one code object for each function, regardless of how many simultaneous
activations records there are).
In this context we can ignore keyword arguments, but a generic memoizer
ought to take care of that as well.
|
settings
- Value:
{'dont_exclude_anything': False,
'edge_colour': <function colourize_edge at 0xb75c41c>,
'include_stdlib': True,
'node_attributes': {'color': '%(col)s',
'label': '%(func)s\\ncalls: %(hits)i\\ntotal time
: %(total_time)f'},
'node_colour': <function colourize_node at 0xb75c3ac>}
|
|
graph_attributes
- Value:
{'graph': {'fontcolor': '0 0 0.5',
'fontname': 'Verdana',
'fontsize': 7,
'label': 'Generated by Python Call Graph v0.4.1\\nhttp://py
callgraph.slowchop.com'},
'node': {'color': '.5 0 .9',
'fontname': 'Verdana',
'fontsize': 7,
...
|
|