View multiple processes for context switching (find which process take the most context switch)

Source: Internet
Author: User
Tags switches

This is the original link http://serverfault.com/questions/190049/find-out-which-task-is-generating-a-lot-of-context-switches-on-linux

The main thing is to use pidstat-w to view context switches,

[email protected]:~# pidstat -w 1linux 4.2.0-16-generic  (Wis-virtual-machine)      April 08, 2016   _i686_   (1 CPU)  10 19 minutes and 27 seconds    UID        pid   cswch/s nvcswch/s  command10 19 minutes, 28 seconds       0         3       3.88      0.00  ksoftirqd/010 19 minutes 28 seconds      0          7     13.59       0.00  rcu_sched10 19 minutes, 28 seconds      0         10      0.97      0.00   watchdog/010 19 minutes 28 seconds      0       833       7.77      0.00  xorg10 19 minutes, 28 seconds   1000       1564      6.80      7.77   compiz

The-t option lets you view the processes under the process.

[Email protected]:~# pidstat-w-T
Linux 4.2.0-16-generic (wis-virtual-machine) April 19, 2016 _i686_ (1 CPU)

08:34 24 sec UID tgid TID cswch/s nvcswch/s Command
08:34 24 sec 0 1-1.63 1.39 systemd
08:34 24 sec 0-1 1.63 1.39 |__systemd
08:34 24 sec 0 2-0.32 0.00 Kthreadd
08:34 24 sec 0-2 0.32 0.00 |__kthreadd
08:34 24 sec 0 3-3.00 0.01 ksoftirqd/0
08:34 24 sec 0-3 3.00 0.01 |__ksoftirqd/0

There is also a watch command when viewing the data, and you can have a man look at it, (watch-tdn0.5 pidstat-w)

View multiple processes for context switching (find which process take the most context switch)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.