top 命令显示 CPU 的信息是从哪里获取?
2016-09-10 11:20
176 查看
Linux top 命令执行后会输出下面的CPU usage信息。
Tasks: 133 total, 1 running, 132 sleeping, 0 stopped, 0 zombie
Cpu(s): 10.0%us, 2.0%sy, 0.0%ni, 88.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
参考 top 代码可以看到 CPU 信息是使用 /proc/stat 里的CPU 数据。
查看内核的 /proc/stat 说明如下:
> cat /proc/stat
cpu 2255 34 2290 22625563 6290 127 456 0 0 0
cpu0 1132 34 1441 11311718 3675 127 438 0 0 0
cpu1 1123 0 849 11313845 2614 0 18 0 0 0
intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...]
ctxt 1990473
btime 1062191376
processes 2915
procs_running 1
procs_blocked 0
softirq 183433 0 21755 12 39 1137 231 21459 2263
The very first "cpu" line aggregates the numbers in all of the other "cpuN"
lines. These numbers identify the amount of time the CPU has spent performing
different kinds of work. Time units are in USER_HZ (typically hundredths of a
second). The meanings of the columns are as follows, from left to right:
- user: normal processes executing in user mode
- nice: niced processes executing in user mode
- system: processes executing in kernel mode
- idle: twiddling thumbs
- iowait: waiting for I/O to complete
- irq: servicing interrupts
- softirq: servicing softirqs
- steal: involuntary wait
- guest: running a normal guest
- guest_nice: running a niced guest
Tasks: 133 total, 1 running, 132 sleeping, 0 stopped, 0 zombie
Cpu(s): 10.0%us, 2.0%sy, 0.0%ni, 88.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
参考 top 代码可以看到 CPU 信息是使用 /proc/stat 里的CPU 数据。
查看内核的 /proc/stat 说明如下:
> cat /proc/stat
cpu 2255 34 2290 22625563 6290 127 456 0 0 0
cpu0 1132 34 1441 11311718 3675 127 438 0 0 0
cpu1 1123 0 849 11313845 2614 0 18 0 0 0
intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...]
ctxt 1990473
btime 1062191376
processes 2915
procs_running 1
procs_blocked 0
softirq 183433 0 21755 12 39 1137 231 21459 2263
The very first "cpu" line aggregates the numbers in all of the other "cpuN"
lines. These numbers identify the amount of time the CPU has spent performing
different kinds of work. Time units are in USER_HZ (typically hundredths of a
second). The meanings of the columns are as follows, from left to right:
- user: normal processes executing in user mode
- nice: niced processes executing in user mode
- system: processes executing in kernel mode
- idle: twiddling thumbs
- iowait: waiting for I/O to complete
- irq: servicing interrupts
- softirq: servicing softirqs
- steal: involuntary wait
- guest: running a normal guest
- guest_nice: running a niced guest
相关文章推荐
- top命令之你不一定懂的cpu显示信息
- CentOS命令top下你不一定懂的cpu显示信息
- 使用exec的top命令获取内存和cpu的使用率
- python 在linux下通过top,和dh命令获得cpu,内存,以及硬盘信息
- adb shell 命令获取手机中的运行资源,内存,CPU,dump信息等等
- Linux top命令中CPU信息的详解(转)
- 在linux的top命令里的cpu信息是什么意思呢?
- top 显示CPU所有核心信息
- top 命令 详解 和 sar -P ALL 查看cpu信息命令
- python 调用top命令获取输出信息
- 如何让新版的top显示多个cpu信息?
- LINUX的TOP信息里显示的CPU内容的含义
- top命令显示按内存或CPU排序
- free命令和top命令显示的信息的意义
- 查看进程占用内存cpu信息,Linux命令—TOP
- Linux slabtop命令——显示内核片缓存信息
- Android执行shell命令(top查看CPU信息)
- adb shell top 获取CPU以及CPU耗电信息
- Linux中的top命令查看内存和cpu信息
- 在linux的top命令里的cpu信息是什么意思呢?