• 查看上下文切换的多的进程(find which process take the most context switch)


    这是原文链接http://serverfault.com/questions/190049/find-out-which-task-is-generating-a-lot-of-context-switches-on-linux

    主要就是用pidstat -w 查看上下文切换,

    root@wis-virtual-machine:~# pidstat -w 1
    Linux 4.2.0-16-generic (wis-virtual-machine)    2016年04月08日  _i686_  (1 CPU)
     
    10时19分27秒   UID       PID   cswch/s nvcswch/s  Command
    10时19分28秒     0         3      3.88      0.00  ksoftirqd/0
    10时19分28秒     0         7     13.59      0.00  rcu_sched
    10时19分28秒     0        10      0.97      0.00  watchdog/0
    10时19分28秒     0       833      7.77      0.00  Xorg
    10时19分28秒  1000      1564      6.80      7.77  compiz

    -t选项可以查看进程下面进程的。

    root@wis-virtual-machine:~# pidstat -w -t
    Linux 4.2.0-16-generic (wis-virtual-machine) 2016年04月19日 _i686_ (1 CPU)

    08时34分24秒 UID TGID TID cswch/s nvcswch/s Command
    08时34分24秒 0 1 - 1.63 1.39 systemd
    08时34分24秒 0 - 1 1.63 1.39 |__systemd
    08时34分24秒 0 2 - 0.32 0.00 kthreadd
    08时34分24秒 0 - 2 0.32 0.00 |__kthreadd
    08时34分24秒 0 3 - 3.00 0.01 ksoftirqd/0
    08时34分24秒 0 - 3 3.00 0.01 |__ksoftirqd/0

    查看数据的时候还有个watch命令,大家也可以man一下看看,(watch -tdn0.5 pidstat -w)

  • 相关阅读:
    穷举
    菱形
    6.824 Lab 3: Fault-tolerant Key/Value Service 3A
    6.824 Lab 2: Raft 2C
    6.824 Lab 2: Raft 2B
    一文学会Rust?
    字符串相似度匹配
    解决gson解析long自动转为科学计数的问题
    commonJs requirejs amd 之间的关系
    关于package.json的理解
  • 原文地址:https://www.cnblogs.com/WisWang/p/5406791.html
Copyright © 2020-2023  润新知