pidstat -w -p 711 1
[root@leilei ~]# ps -ef|grep nginx
root 13974 1 0 14:23 ? 00:00:00 nginx: master process nginx
www 13975 13974 0 14:23 ? 00:00:00 nginx: worker process
www 13976 13974 0 14:23 ? 00:00:00 nginx: worker process
www 13977 13974 0 14:23 ? 00:00:00 nginx: cache manager process
root 18769 9104 0 14:49 pts/0 00:00:00 grep --color=auto nginx
[root@leilei ~]# pidstat -w -p 13975 1
Linux 3.10.0-693.el7.x86_64 (leilei) 04/28/2020 _x86_64_ (2 CPU)
02:49:27 PM UID PID cswch/s nvcswch/s Command
02:49:28 PM 1000 13975 0.00 0.00 nginx
02:49:29 PM 1000 13975 0.00 0.00 nginx
02:49:30 PM 1000 13975 0.00 0.00 nginx
02:49:31 PM 1000 13975 0.00 0.00 nginx
02:49:32 PM 1000 13975 0.00 0.00 nginx
02:49:33 PM 1000 13975 0.00 0.00 nginx
如果 cswch/s 较为均匀,说明切换正常