I have a long-running Python service, and I would like to know how many accumulated wall hours were spent on any running threads (i.e. threads that were not blocked for any other reason), waiting for the GIL. Is there an easy way to do this? For example, perhaps I could periodically upload some counter to my log file.
My main motivation is to eliminate the GIL as a source of delayed covert responses from these lengthy processes. There is no reason to suspect GIL (other than that it will be consistent with the symptoms), but other forms of logging have not yet appeared, so if this is easy, it would be nice to have this information.
source
share