I use hotshot to profile my Python program. Is there a way to aggregate profiles and see the overall result in Kcachegrind?
After some research, I used pstats to aggregate profiles in the manner below, and used pyprof2calltree to convert the result to kcachegrind format
>>> pf = pstats.Stats("profile1.prof") >>> p2 = pf.add("profile2.prof") >>> p2.dump_stats("aggregated.prof")
pyprof2calltree gave me such an error.
File "/usr/local/bin/pyprof2calltree", line 9, in <module> load_entry_point('pyprof2calltree==1.1.0', 'console_scripts', 'pyprof2calltree')() File "/usr/local/lib/python2.7/dist-packages/pyprof2calltree.py", line 240, in main kg.output(file(outfile, 'wb')) File "/usr/local/lib/python2.7/dist-packages/pyprof2calltree.py", line 106, in output self._entry(entry) File "/usr/local/lib/python2.7/dist-packages/pyprof2calltree.py", line 167, in _entry self._subentry(lineno, subentry, call_info) File "/usr/local/lib/python2.7/dist-packages/pyprof2calltree.py", line 178, in _subentry print >> out_file, 'calls=%d %d' % (call_info[0], co_firstlineno) TypeError: 'int' object is not subscriptable
Am I doing something wrong here or is there any other way to do this?
source share