[Python-Dev] cProfile and threads

Kristján Valur Jónsson kristjan at ccpgames.com
Tue Aug 17 11:22:15 CEST 2010


Hello there.
I'd like to draw your attention to two feature requests / patches that I've subbmitted:
http://bugs.python.org/issue9609
http://bugs.python.org/issue9622

These patches are the result of work that we have done in profiling Stackless Python server applications at runtime, but they apply just as well to C Python.
The first patch makes _lsprof, the engine behind cProfile, multi-stack aware.  This allows the same cProfiler.Profile() instance to be active on multiple python threads and still meaningful information is gathered.
The second patch allows to set the trace/profile function in python globally, so that all threads are affected.  This is essential if you want to take a profililng snapshot of a running application.

We now use this extensively, to monitor the live behaviour of our EVE game servers.  A HTTP backend server is used to control the profiler (profile.enable(), profile disable() at runtime) and explore its output.

I haven't seen any feadback on these submissions and would appreciate some.

Cheers,
Kristján
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100817/2de5bc8c/attachment.html>


More information about the Python-Dev mailing list