line_profiler icon indicating copy to clipboard operation
line_profiler copied to clipboard

Enable tracing for all threads.

Open SyamGadde opened this issue 10 years ago • 3 comments

PyEval_SetTrace only sets the current thread's tracing callback. This patch makes enable_count thread-local, so that tracing is enabled/disabled on a thread-specific basis. Without this, only the thread that happened to trigger the enable() call would have had tracing enabled.

SyamGadde avatar Nov 20 '14 15:11 SyamGadde

Tested and works for me.

jimi-c avatar Oct 02 '17 06:10 jimi-c

Works for me too. This is also very short patch so hopefully not too hard to review. In today's world where many programs need multiple threads, supporting profiling multiple threads is very useful.

Alexey-Akishin avatar Oct 25 '17 15:10 Alexey-Akishin

After four years, I am also surprised that this has not been merged. It has been used for a number of my multithreaded projects, and it painful to carry around a non-pip version.

Pinging @rkern ...

gaasedelen avatar Aug 08 '18 00:08 gaasedelen