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?
[Technorati Tag: Performance Testing]
( Feb 13 2007, 11:12:41 AM PST ) [Listen] Permalink Comments [3]
Pinewood Derby Racing
This was all new to me. Last year I blogged about it but Duncan didn't want my help that year; he wanted to do it all himself, so I didn't take it any further. This year, I followed some of the links from that post and put together some ideas on what we should do:
- The car needed to be streamline.
- The center of gravity for the car should be an inch to 1 ½
inches in front of the rear axle.
- The weight of the car should be as close to five ounces as possible (maximum weight allowed).
So we came up with the design above (the orange/brown car). It lost some of its streamline-ness after I'd put the weights on, so as to get the center of gravity where it needed to be. Even though Duncan should have been doing as much of this work himself, he wasn't up to doing the cutting. He did help with the sealing, sanding and painting. I screwed the weights on.
On Sunday afternoon, we turned up early and weighed in. We were 0.2 ounces less than maximum, but Duncan didn't want me to add any more weights. We were given the option of dusting the axles with graphite dust to help reduce friction. We did this, but I think it wasn't enough. More on this below.
The races began. In the two heats that Duncan's car was in, it came last each time. Duncan was very upset. As any good parent knows, you don't like to disappoint your kids, so I started watching all the rest of the races intently to see if I could see where we went wrong and to see if I could come up with some ideas to help build a winning car for next year.
Here are my (unconfirmed) findings:
- The streamline-ness of the car is not that big a deal. All sizes
and shapes of cars won their heats. Shape did not appear to be that big a factor.
- The axles and the wheels should be polished and the wheels pushed into the side
of the car so that there is minimal space between the racing tracks
"ridges" and the car (to stop it "wobbling around"). The wheels need to be
properly aligned so the car will go as straight as possible for as long as
possible. My guess was these were the main reasons why we failed this year.
- The graphite dusting is really important. It should be done much
earlier and the wheels need to be continually spun to let this
dust work in.
- I'm still not convinced on exactly what the positioning of where the weights should be. Again, the winning cars seemed to have their weights (and centers of gravity) all over the place. One thing that looks like it's needed is to try to get the weight as low as possible. Maybe our next car should have the weights embedded beneath the car.
The other thing we are going to do is get a couple kits earlier than we did this year and try experimenting with different things.
It's a pity that there isn't a publically available test track that we can practice on before the next race.
[Technorati Tag: Pinewood Racing]
( Feb 13 2007, 07:48:54 AM PST ) [Listen] Permalink Comments [14]












