title: Is there an easy way to tell how much time is spent waiting for the Python GIL?
body: <p>I have a long-running Python service and I'd like to know how much cumulative wall clock time has been spent by any runnable threads (i.e., threads that weren't blocked for some other reason) waiting for the GIL.  Is there an easy way to do this?  E.g., perhaps I could periodically dump some counter to its log file.</p>
  
  <p>My underlying motivation is to rule out the GIL as a source of mystery response latency from these long-running processes.  There is no particular reason to suspect the GIL (other than that it would fit the symptoms), but other forms of logging haven't turned up anything yet, so, <em>if it is easy</em>, it would be nice to have this information.</p>