ubuntu下查看cpu的占有率

1.查看cpu的相关信息

#查看物理CPU的个数

#cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
 
#查看逻辑CPU的个数
#cat /proc/cpuinfo |grep "processor"|wc -l
 
#查看CPU是几核
#cat /proc/cpuinfo |grep "cores"|uniq
 
#查看CPU的主频

#cat /proc/cpuinfo |grep MHz|uniq


cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

      8  Intel(R) Xeon(R) CPU            E5410   @ 2.33GHz

(看到有8个逻辑CPU, 也知道了CPU型号)


cat /proc/cpuinfo | grep physical | uniq -c

      physical id      : 0

      physical id      : 1

(说明实际上是两颗4核的CPU)


getconf LONG_BIT

32

(说明当前CPU运行在32bit模式下, 但不代表CPU不支持64bit)


cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l

8

(结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit)


2.查看CPU的利用率

                   先执行top命令,再按1,可以看到每个CPU的利用率

                   显示的信息中%us的值,表示CPU使用了多少


CPU %user %system %nice %idle %iowait %irq %soft intr/s

 

CPU 处理器ID

user 在internal时间段里,用户态的CPU时间(%),不包含 nice值为负 进程 (usr/total)*100 

system 在internal时间段里,核心时间(%) (system/total)*100

nice 在internal时间段里,nice值为负进程的CPU时间(%) (nice/total)*100 


idle 在internal时间段里,CPU除去等待磁盘IO操作外的因为任何原因而空闲的时间闲置时间(%)(idle/total)*100

 

iowait 在internal时间段里,硬盘IO等待时间(%) (iowait/total)*100

irq 在internal时间段里,硬中断时间(%) (irq/total)*100

soft 在internal时间段里,软中断时间(%) (softirq/total)*100



intr/s 在internal时间段里,每秒CPU接收的中断的次数intr/total)*100 


当是多核cpu时,几个cpu,占有率可达到对应的n*100%


  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值