[PyQt] Method names from SIP-wrapped classes not showing in
cProfile output
Håkon Bertheussen
haakon.bertheussen at gmail.com
Thu May 21 19:49:38 BST 2009
I'm trying to profile some code that uses SIP wrapped classes
extensively. I'm having a problem with the output from cProfile;
method names of sip-wrapped classes are not showing, instead a string
like "{sip.methoddescriptor object at 0x...}" is displayed. The thing
is I know this used to work with a previous setup I had. Since then
I've updated Python, SIP and PyQt, so I don't know which is the
culprit. I'm using Python 2.6.2, PyQt-win-gpl-4.5-snapshot-20090507
and sip-4.8-snapshot-20090430.
Example:
from PyQt4 import QtGui
import cProfile
def test():
for _ in xrange(10):
image = QtGui.QImage(3000, 3000, QtGui.QImage.Format_ARGB32)
image.fill(QtGui.qRgb(50, 100, 150))
def main():
cProfile.run('test()')
if __name__=='__main__':
main()
This outputs:
$>proftest.py
23 function calls in 0.324 CPU seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.003 0.003 0.324 0.324 <string>:1(<module>)
1 0.024 0.024 0.321 0.321 proftest.py:4(test)
10 0.000 0.000 0.000 0.000 {PyQt4.QtGui.qRgb}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Prof
iler' objects}
10 0.297 0.030 0.297 0.030 {sip.methoddescriptor object at 0x
0245D1B0}
More information about the PyQt
mailing list