[issue9609] make cProfile multi-stack aware

Kristján Valur Jónsson report at bugs.python.org
Thu Sep 9 17:50:45 CEST 2010


Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:

Here is a new patch.  When 'allthreads' is specified to cProfile.Profile.enable(), profling is enabled on all threads.
The testsuite tests to see that all threads do indeed register, it does not attempt to validate the timings.

It turns it on for all threads (in all interpreter states).  Maybe this is overdoing it.  Interpreter states is something new to me, a py3k feature?

Now, the problem with this approach is that it only works with threads already in existence when called.  The "global" appcoach that we used to solve a similar problem in Stackless Python, however, will invoke the tracing/profiling functionality for all tasklets, even if they were new.  The same would be useful for threads in regular python, especially in long running server applications.

However, this patch stands on its own.  This particular shortcoming could be fixed later.

----------
Added file: http://bugs.python.org/file18813/cprofile2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9609>
_______________________________________


More information about the Python-bugs-list mailing list