title: Monitoring pthread context switching
body: <p>I would like to monitor the the context switching behavior in a multi-threaded pthread application.</p>
  
  <p>In other RTOSes(Micro C OS)  I have been able to register a context switch callback for each thread in the application, and then log (or toggle a gpio) and watch the thread context switching in real time.  This was a valuable tool for debugging the real time behavior and interaction of the multiple threads.</p>
  
  <p>My current environment is embedded linux utilizing the pthread api.  Is there a way to monitor each of the context switches?</p>