日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux 跑cpu负载工具,CPU负载查看工具

發布時間:2025/4/17 linux 64 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux 跑cpu负载工具,CPU负载查看工具 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

uptime

[root@localhost ~]# uptime

15:24:28 up 5:18, 2 users, load average: 0.00, 0.01, 0.05

顯示內容說明:

15:24:28 #系統當前時間

up 5:18? ? #主機已運行時間(時間越長,說明越穩定)

2 user? ? ? #用戶連接數(總連接數)

load average: 0.00, 0.01, 0.05? ?# 系統平均負載,統計最近1,5,15分鐘的系統平均負載

注:

如果每個CPU內核的當前活動進程數小于3,則系統的性能良好。如果每個CPU內核的當前進程數大于5,則性能有嚴重問題。

查找CPU使用最多的進程

top? ? ?#按大寫P 排序(top本身耗資源,高負載時不建議使用)

[root@localhost ~]# top

top - 15:35:16 up 5:28, 2 users, load average: 0.00, 0.01, 0.05

Tasks: 357 total, 2 running, 355 sleeping, 0 stopped, 0 zombie

%Cpu(s): 0.3 us, 0.7 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

KiB Mem : 1003160 total, 123316 free, 145532 used, 734312 buff/cache

KiB Swap: 1048572 total, 1048520 free, 52 used. 635784 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

37994 root 20 0 130156 2028 1268 R 0.7 0.2 0:00.67 top

1 root 20 0 56632 4180 2424 S 0.0 0.4 0:03.68 systemd

2 root 20 0 0 0 0 S 0.0 0.0 0:00.35 kthreadd

3 root 20 0 0 0 0 S 0.0 0.0 0:03.34 ksoftirqd/0

5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H

7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0

8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh

9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/0

10 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/1

ps? ? # –sort 排序 ,-pcpu 顯示絕對路徑

[root@localhost ~]# ps -aux --sort -pcpu |head

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

root 38059 2.6 0.5 403664 5416 ? Sl 15:41 0:00 /usr/libexec/packagekitd

root 762 0.1 0.4 268816 4260 ? Ssl 10:06 0:27 /usr/bin/vmtoolsd

root 1 0.0 0.4 56632 4180 ? Ss 10:06 0:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 24

root 2 0.0 0.0 0 0 ? S 10:06 0:00 [kthreadd]

root 3 0.0 0.0 0 0 ? S 10:06 0:03 [ksoftirqd/0]

root 5 0.0 0.0 0 0 ? S< 10:06 0:00 [kworker/0:0H]

root 7 0.0 0.0 0 0 ? S 10:06 0:00 [migration/0]

root 8 0.0 0.0 0 0 ? S 10:06 0:00 [rcu_bh]

root 9 0.0 0.0 0 0 ? S 10:06 0:00 [rcuob/0]

查看CPU信息

[root@localhost ~]# cat /proc/cpuinfo

processor : 0

vendor_id : GenuineIntel

cpu family : 6

model : 42

model name : Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz

stepping : 7

microcode : 0x29

cpu MHz : 2491.969

cache size : 3072 KB

physical id : 0

siblings : 1

core id : 0

cpu cores : 1

apicid : 0

initial apicid : 0

fpu : yes

fpu_exception : yes

cpuid level : 13

wp : yes

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm ida arat epb pln pts dtherm tsc_adjust

bogomips : 4983.93

clflush size : 64

cache_alignment : 64

address sizes : 42 bits physical, 48 bits virtual

power management:

查看CPU個數

[root@localhost ~]# cat /proc/cpuinfo |grep processor |wc -l

4

查看CPU核心數

[root@localhost ~]# cat /proc/cpuinfo |grep "core id" |wc -l

8

mpstat? ? #查看CPU運行情況

1、安裝

[root@localhost ~]# yum -y install sysstat

2、使用

語法:mpstat [t]? [n]? ? ?#t為更新時間,n為次數

[root@localhost ~]# mpstat -P ALL 10 3

Linux 3.10.0-229.el7.x86_64 (localhost.localdomain) 2018年07月17日 _x86_64_ (1 CPU)

16時23分28秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle

16時23分38秒 all 0.00 0.00 0.10 0.00 0.00 0.00 0.00 0.00 0.00 99.90

16時23分38秒 0 0.00 0.00 0.10 0.00 0.00 0.00 0.00 0.00 0.00 99.90

16時23分38秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle

16時23分48秒 all 0.10 0.00 0.00 0.00 0.00 0.10 0.00 0.00 0.00 99.80

16時23分48秒 0 0.10 0.00 0.00 0.00 0.00 0.10 0.00 0.00 0.00 99.80

16時23分48秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle

16時23分58秒 all 0.10 0.00 0.30 0.00 0.00 0.00 0.00 0.00 0.00 99.60

16時23分58秒 0 0.10 0.00 0.30 0.00 0.00 0.00 0.00 0.00 0.00 99.60

平均時間: CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle

平均時間: all 0.07 0.00 0.13 0.00 0.00 0.03 0.00 0.00 0.00 99.77

平均時間: 0 0.07 0.00 0.13 0.00 0.00 0.03 0.00 0.00 0.00 99.77

顯示參數說明:

%user :CPU使用占比,不包含nice值為負進程 (usr/total)*100

%nice:低優先級進程使用CPU占比,nice值為負進程的CPU時間(%) (nice/total)*100

%sys :系統使用CPU占比,內核時間(%) (system/total)*100

%iowait :CPU等待IO占比,硬盤IO等待時間(%) (iowait/total)*100

%irq :CPU處理硬中斷占比,硬中斷時間(%) (irq/total)*100

%soft :CPU處理軟中斷占比,軟中斷時間(%) (softirq/total)*100

%idle: CPU空閑占比,閑置時間(%) (idle/total)*100

溫馨提示:如無特殊說明,本站文章均為作者原創,轉載請注明出處!

總結

以上是生活随笔為你收集整理的linux 跑cpu负载工具,CPU负载查看工具的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。