Olivier Grisel avatar Olivier Grisel committed 588e5ca

integrate bugfix by David Glick in subentry conversion

Comments (0)

Files changed (3)

 .. _kdesdk: http://websvn.kde.org/trunk/KDE/kdesdk/kcachegrind/converters/
 .. _screenshots: http://images.google.fr/images?q=kcachegrind
 
-Authors
-=======
+Authors and contributors
+========================
 
 - David Allouche (original author)
 - Jp Calderone
 - Itamar Shtull-Trauring
 - Johan Dahlin
 - Olivier Grisel (repackaging and pstats support)
+- David Glick (fix in conversion algorithm)
 
 
 Command line usage
 Change log
 ==========
 
+ - 1.1.0 - 2008-12-21: integrate fix in conversion by David Glick
  - 1.0.3 - 2008-10-16: fix typos in 1.0 release
  - 1.0 - 2008-10-16: initial release under the pyprof2calltree name
 

pyprof2calltree.py

 
         # collect the new entry
         entries[code_info] = entry
-        allcallers[code_info] = callers.keys()
+        allcallers[code_info] = callers.items()
 
     # second pass of stats to plug callees into callers
     for entry in entries.itervalues():
         entry_label = cProfile.label(entry.code)
         entry_callers = allcallers.get(entry_label, [])
-        for entry_caller in entry_callers:
-            entries[entry_caller].calls.append(entry)
+        for entry_caller, call_info in entry_callers:
+            entries[entry_caller].calls.append((entry, call_info))
 
     return entries.values()
 
         else:
             lineno = code.co_firstlineno
 
-        for subentry in calls:
-            self._subentry(lineno, subentry)
+        for subentry, call_info in calls:
+            self._subentry(lineno, subentry, call_info)
         print >> out_file
 
-    def _subentry(self, lineno, subentry):
+    def _subentry(self, lineno, subentry, call_info):
         out_file = self.out_file
         code = subentry.code
         #print >> out_file, 'cob=%s' % (code.co_filename,)
         print >> out_file, 'cfn=%s %s:%d' % (
             co_name, co_filename, co_firstlineno)
         print >> out_file, 'cfi=%s' % (co_filename,)
-        print >> out_file, 'calls=%d %d' % (subentry.callcount, co_firstlineno)
+        print >> out_file, 'calls=%d %d' % (call_info[0], co_firstlineno)
 
-        totaltime = int(subentry.totaltime * 1000)
+        totaltime = int(call_info[3] * 1000)
         print >> out_file, '%d %d' % (lineno, totaltime)
 
 def main():
 from setuptools import setup, find_packages
 import sys, os
 
-version = '1.0.3'
+version = '1.1.0'
 classifiers = """\
 Development Status :: 5 - Production/Stable
 Environment :: Console
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.