How do I measure separate CPU core usage for a process?

前端 未结 8 1489
故里飘歌
故里飘歌 2021-01-29 18:45

Is there any way to measure a specific process CPU usage by cores?

I know top is good for measuring the whole system\'s CPU usage by cores and taskset can provide inform

8条回答
  •  感情败类
    2021-01-29 19:19

    You can use:

     mpstat -P ALL 1
    

    It shows how much each core is busy and it updates automatically each second. The output would be something like this (on a quad-core processor):

    10:54:41 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
    10:54:42 PM  all    8.20    0.12    0.75    0.00    0.00    0.00    0.00    0.00   90.93
    10:54:42 PM    0   24.00    0.00    2.00    0.00    0.00    0.00    0.00    0.00   74.00
    10:54:42 PM    1   22.00    0.00    2.00    0.00    0.00    0.00    0.00    0.00   76.00
    10:54:42 PM    2    2.02    1.01    0.00    0.00    0.00    0.00    0.00    0.00   96.97
    10:54:42 PM    3    2.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   98.00
    10:54:42 PM    4   14.15    0.00    1.89    0.00    0.00    0.00    0.00    0.00   83.96
    10:54:42 PM    5    1.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.00
    10:54:42 PM    6    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
    10:54:42 PM    7    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
    

    This command doesn't answer original question though i.e. it does not show CPU core usage for a specific process.

提交回复
热议问题