[link] Update: talk video is here http://video.google.com/videoplay?docid=-7786085282361681216 (my part starts at 37min) Tonight I spoke at the baypiggies event at Google. My onscreen notes are repeated below. The things I recommended in my talk were: The code is at http://projects.bigasterisk.com/silhouette/pstats2web and http://projects.bigasterisk.com/silhouette/profileResults.html (the exhibit viewer). http://projects.bigasterisk.com/silhouette/ is a darcs repository too. Other web graphs: /home/drewp/projects/ffg-dash/test/sparqlBench.py % ./pstats2web /tmp/pro -o out.html Ubuntu packages: kcachegrind-convertors, kcachegrind % hotshot2calltree /tmp/pro > calltree % kcachegrind calltree see callee map of the 'parseTerm' function Check out exhibit at http://simile.mit.edu/exhibit/ % ./pstats2web /tmp/pro -j out.js -m 60 View profileResults.html in a browser, which reads out.js from the
same directory.
(1) 2007-02-08T23:58:51 Profiler talk at baypiggies: Standard profile results
>>> import hotshot, pstats
>>> p = hotshot.Profile().runcall(main)
>>> pstats.Stats(p).sort_stats('time').print_stats()
58666 function calls (56532 primitive calls) in 0.980 CPU seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.240 0.240 0.240 0.240 :0(create)
472 0.220 0.000 0.220 0.000 :0(call)
1696 0.050 0.000 0.050 0.000 sre_parse.py:182(__next)
6022 0.030 0.000 0.030 0.000 :0(append)
181/27 0.030 0.000 0.060 0.002 sre_compile.py:27(_compile)
216 0.020 0.000 0.030 0.000 interface.py:850(fromFunction)
26 0.020 0.001 0.020 0.001 advice.py:69(addClassAdvisor)
23 0.020 0.001 0.220 0.010 netconnect:125(__init__)
1381/201 0.020 0.000 0.040 0.000 ro.py:58(_flatten)
1 0.020 0.020 0.980 0.980 netconnect:23(?)
1 0.020 0.020 0.020 0.020 Tkinter.py:31(?)
1 0.010 0.010 0.010 0.010 urllib.py:1086(quote)
2590 0.010 0.000 0.010 0.000 :0(get)
1 0.010 0.010 0.010 0.010 compat.py:115(Connection)
1 0.010 0.010 0.010 0.010 tksupport.py:24(?)
Displaying as html
Displaying with kcachegrind
Displaying with exhibit
Still looking for
Posted by Drew at 2007-02-09T20:16:58
http://pycallgraph.slowchop.com/ is a related project that collects the call graph of a running program and renders it with graphviz. kcachegrind can do a similar thing, although I'm sure pycallgraph would be easier to tinker with if you wanted new features.
![]() | Unless otherwise noted, all content licensed by Drew Perttula under a Creative Commons License. |