Does cProfile include the time waiting for the GIL

32 Views Asked by At

I have a multi threaded program and ran a section of the main thread under cProfile. To my surprise, according to the cumtime reported by cProfile, writing a line to a file took longer than I expected (several 100 milliseconds), so I want to know if indeed the file writing takes so long or I missed an interaction with other threads.

I know that cProfile only profiles the thread in which it was started, and I know that IO operations usually release the global interpreter lock (GIL). What I do not know is how to interpret the result by cProfile.

Does the timing reported by cProfile include the time waiting for the GIL, or not?

0

There are 0 best solutions below