I'm using Pycallgraph to generate output, but I want to save the intermediate graphd output (instead of generating an image) because I want to make some small modifications to it.
I'm running as:
PYTHONPATH=. pycallgraph -d graphviz -- ./ab_ndh_graph.py > out.graphd
Which is generating 2x things:
- pycallgraph.png -- this is the entire call graph (graphd output in out.graphd)
- filter_max_depth.png -- this is the code based call graph (correct, but no graphd output)
How can I get the graphd output to be generated for "filter_max_depth" instead?
File contents:
config = Config(max_depth=2)
config.trace_filter = GlobbingFilter(exclude=[
'pycallgraph.*',
])
graphviz = GraphvizOutput(output_file='filter_max_depth.png')
with PyCallGraph(output=graphviz, config=config):
o = AB_NDH()
o.run()
The
GraphvizOutput
class uses a temporary file to output thedot
source to, and runs thedot
command line tool on that file before cleaning it up again.However, you can regenerate the same file contents rather easily by calling the
generate()
method after runningPyCallGraph
:You could also switch on the debug option of your
config
object; in that case thedot
source is written to the log. Setting.debug
flag on theconfig
object:but then don't use
-d
on the command line:Essentially, that's the same as adding
print graphviz.generate()
however.