New submission from Kristján Valur Jónsson <krist...@ccpgames.com>:
issue 9609 updates _lsprof.c to be multi-stack aware. This allows cProfile.Profile() objects to be shared by many threads and provide meaningfull results. This update makes it more convenient to profile running, multi-threaded, applications. By adding a set of global (cross thread) profiling hooks that override the per-thread hooks, it is possible to enable and disable profiling/tracing for the entire program. A multithreaded python could then do something like this: def ProfileMe(t): p = cProfile.Profile() p.enable(global=True) time.sleep(t) p.disable() p.print_stats() A patch is provided, also, an updated _lsprof adding the new 'global' flag to the "enable" function. (This paradigm is used successfully in EVE, albeit with "global" there meaning all tasklets, to do snapshot profiling of a running server. The results are displayed on a web page served by the server backend.) ---------- components: Interpreter Core files: globaltrace.patch keywords: patch, patch messages: 114054 nosy: krisvale priority: normal severity: normal status: open title: Allow to set profile/trace function globally type: feature request versions: Python 3.2 Added file: http://bugs.python.org/file18545/globaltrace.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9622> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com