Original please indicate the source: https://www.cnblogs.com/agilestyle/p/11484624.html
pidstat command can help us to monitor specific thread context switching
By pidstat -help command, we can view a few of the following parameters can be used to monitor the performance of the thread:
Common parameters:
- -u: the default parameters, displays cpu usage of each process;
- -r: Displays the memory usage of each process;
- -d: display of each process I / O usage;
- -w: display context for each process handover situation;
- -p: Specifies the process ID;
- -t: Displays statistics threads in the process of
First, pidstat -w -p pid command line, we can look into the process context switching:
cswch / s: the number of active task context switches per second
nvcswch / s: Passive task context switches per second Number
After that, pidstat -w -p pid -t command line, we can view the specific context switching thread: