Orca Python Call Graph

Yesterday I saw a link on popurls.com to pycallgraph, a Python library that will generate call graphs and thought that I'd give it a try with Orca

I had to wait until today to download it, as being popular knocked out their server. I also had to install Graphviz, a prerequisite. That was easy. Just a few clicks away via the Synaptic Package manager on my Ubuntu system.

Integrating the pycallgraph code into Orca was trivial. Two lines near the start of the application:

import pycallgraph
pycallgraph.start_trace()

and then two lines just before it terminates:

pycallgraph.stop_trace()
pycallgraph.make_graph('orca-call-graph.png')

Creating the call graph counts is very CPU and memory intensive, so I then had to make a couple other adjustments to the Orca code, to convince it that it hadn't commited suicide:

  • turn off the watchdog process than pings Orca to see if it was still alive.

  • turn off the timeout callback with Orca, so that it wouldn't think it was hung.

If anybody else is interested, here's the full set of diffs I had to make to Orca.

As Orca was pretty much unusable whilst these statistics were being instrumented, I just started up Orca and once it had fully started, I then just terminated it.

That generated a 16188 x 4187 PNG Orca call graph image, which is quite awkward to view.

Although it's interesting and quite clever (and probably very helpful with small, simple Python applications), I think in order to be useful with Orca, the call graph data needs to be in a different format. Maybe just plain old ASCII table entry. Bonus points if it can do a function tree hierarchical view usage in ASCII too. I also wonder whether this is something that an appropriate set of DTrace probes would solve, so much more simply.

Any good simple alternative Python call graph packages out there?

[]

[]

[]

Comments:

Post a Comment:
Comments are closed for this entry.
About

user12607856

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today