[PyKDE] python profiler with pyqt

Solly Brown sollyb at cse.unsw.edu.au
Fri Nov 19 00:07:33 GMT 2004


Richie, Phil,

Thanks for the info -- I misunderstood the profiler documentation.

Perhaps the doc could be worded more clearly though... it currently reads:

"All time spent in C code (including built-in functions) will be charged 
to the Python function that invoked the C code."

To me this makes it sound like if you call 'foo' (a PyQt method, say) and 
foo runs away and calls some C code, then all the time spent in the C code 
will be charged to 'foo'. It would be clearer if it said something like 
"python functions which wrap C code are invisible to the profiler".

Anyway, I know now, and am eagerly awaiting the final release of python 
2.4.

Many thanks, Solly



On Thu, 18 Nov 2004, Phil Thompson wrote:

>>
>> [Solly]
>>> Has anyone tried using the python profiler to profile a pyQt-based app?
>>>
>>> When I run it on my application it ignores all the qt function calls,
>>> and
>>> only profiles methods which I have defined myself.
>>
>> I don't use PyQt, but I suspect the reason is that the PyQt calls are
>> implemented directly in C.  The Python profiler only profiles functions
>> that are implemented in Python.
>>
>> I have a recipe in the Python Cookbook here:
>>
>>   http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81535
>>
>> that lets you wrap a C module in a transparent Python wrapper, so that
>> the profiler will work for it.  Whether it's reasonable to attempt to do
>> this for something as large as PyQt I don't know.
>
> Python 2.4 supports profiling of C functions.
>
> Phil
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>


-------------------------------------

Solly Brown

Robotics Group
Department of Artificial Intelligence
University of New South Wales / NICTA

e: sollyb at cse.unsw.edu.au
p: (02) 9385 7779
m: School of Computer Science and Engineering
    University of New South Wales
    NSW 2052
    Australia




More information about the PyQt mailing list