I suspect that my application suffers from too much context switches. There is huge amount of threads (do not ask why) and I wonder whether overhead related to switching context becomes problematic. My question here is:
- How to know for sure that there is actually too much context switches? I can use
perf sched. - You know, even if there is 10k threads it does not mean that every thread needs CPU in given quantom of time (because of being blocked on I/O / lock). But, is it possible in general way to know how time my threads are actually wait for CPU?