Counting context switches per thread

Posted by Sarmun on Stack Overflow See other posts from Stack Overflow or by Sarmun
Published on 2010-03-14T20:30:48Z Indexed on 2010/03/14 20:35 UTC
Read the original article Hit count: 165

Is there a way to see how many context switches each thread generates? (both in and out if possible) Either in X/s, or to let it run and give aggregated data after some time. (either on linux or on windows)

I have found only tools that give aggregated context-switching number for whole os or per process.

My program makes many context switches (50k/s), probably a lot not necessary, but I am not sure where to start optimizing, where do most of those happen.

© Stack Overflow or respective owner

Related posts about context-switch

Related posts about Performance