Message114054
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.) |
|
Date |
User |
Action |
Args |
2010-08-16 17:17:16 | kristjan.jonsson | set | recipients:
+ kristjan.jonsson |
2010-08-16 17:17:15 | kristjan.jonsson | set | messageid: <1281979035.75.0.299243674716.issue9622@psf.upfronthosting.co.za> |
2010-08-16 17:17:13 | kristjan.jonsson | link | issue9622 messages |
2010-08-16 17:17:11 | kristjan.jonsson | create | |
|