简体   繁体   中英

How can we sort threads on Linux by their System CPU (not the overall or User CPU)?

Top can be used to sort processes/threads by overall CPU. How about sorting threads just by their system CPU? I am trying to investigate a case of high system CPU on a server, and strace gives me the breakup of system time in terms of system calls made by a thread. But, how does one identify the thread that contributes the most to System CPU (the thread that makes the most expensive syscalls, essentially)?

syscalls as reported by strace may or may not have correlation with the time spent actively doing something in the kernel. In fact you don't want to look at this most of the time.

What you want instead is a flamegraph and go from there. In particular, it may be kernel is spending a lot of time not even executing any syscalls in the first place.

http://www.brendangregg.com/flamegraphs.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM