标签:改变 ide cache top init and iso command user
在linux中内置了很多的性能监控命令,top是其中一个较为全面的工具。先看一下man手册
The top program provides a dynamic real-time view of a running system. It can display system summary information as well as
a list of processes or threads currently being managed by the Linux kernel. The types of system summary information shown
and the types, order and size of information displayed for processes are all user configurable and that configuration can be
made persistent across restarts.
The program provides a limited interactive interface for process manipulation as well as a much more extensive interface for
personal configuration -- encompassing every aspect of its operation. And while top is referred to throughout this docu‐
ment, you are free to name the program anything you wish. That new name, possibly an alias, will then be reflected on top‘s
display and used when reading and writing a configuration file.
可以清晰地看到,top命令可以提供一个系统的实时动态视图
输入top,如下图
top - 16:51:19 up 1 min, 0 users, load average: 0.52, 0.58, 0.59
Tasks: 4 total, 1 running, 3 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 32669.6 total, 22110.8 free, 10334.8 used, 224.0 buff/cache
MiB Swap: 98304.0 total, 98282.4 free, 21.6 used. 22204.1 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 8892 308 276 S 0.0 0.0 0:00.09 init
6 root 20 0 8900 220 180 S 0.0 0.0 0:00.00 init
7 zhangxu 20 0 18100 3628 3516 S 0.0 0.0 0:00.16 bash
70 zhangxu 20 0 18904 2068 1452 R 0.0 0.0 0:00.01 top
第一行从左到右依次是,效果同uptime 命令
当前时间 16:51:19 系统运行时间1 min 当前登录用户数 0 users 1分钟、5分钟、15分钟前到现在的平均值 0.52, 0.58, 0.59
第二行为进程信息
进程总数4 total, 运行进程 1 running, 睡眠进程 3 sleeping, 停止进程 0 stopped, 僵尸进程 0 zombie
第三行为cpu信息
%Cpu(s): 用户空间占用CPU百分比 0.0 us, 内核空间占用CPU百分比 0.0 sy, 用户进程空间内改变过优先级的进程占用CPU百分比0.0 ni,空闲CPU百分比100.0 id, IO等待占用CPU的百分比0.0 wa, 硬中断(Hardware IRQ)占用CPU的百分比0.0 hi, 软中断(Software Interrupts)占用CPU的百分比0.0 si, 就是Xen Hypervisor分配给运行在其它虚拟机上的任务的实际CPU时间0.0 st
第四行为内存信息
物理内存总量32669.6 total, 空闲内存总量22110.8 free, 使用中的内存总量10334.8 used, 缓存缓冲使用的内存总量224.0 buff/cache
第五行为swap分区信息
交换区总量98304.0 total, 空闲交换区总量 98282.4 free, 使用的交换区总量21.6 used. 可使用的交换区总量 22204.1 avail Mem
同时top有一些交互的指令,可以细化数据
1、按数字键1,可显示每个逻辑cpu的使用状况
%Cpu0 : 0.6 us, 7.8 sy, 0.0 ni, 86.2 id, 0.0 wa, 5.3 hi, 0.0 si, 0.0 st
%Cpu1 : 1.0 us, 0.0 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 : 1.7 us, 3.0 sy, 0.0 ni, 95.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu3 : 0.7 us, 0.3 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu4 : 1.0 us, 3.0 sy, 0.0 ni, 96.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu5 : 0.7 us, 1.3 sy, 0.0 ni, 98.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu6 : 0.0 us, 1.0 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu7 : 3.3 us, 0.7 sy, 0.0 ni, 96.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
2、按b可高亮运行中进程(当前仅top进程处于型状态)
1 root 20 0 8892 308 276 S 0.0 0.0 0:00.09 init
6 root 20 0 8900 220 180 S 0.0 0.0 0:00.00 init
7 zhangxu 20 0 18100 3628 3516 S 0.0 0.0 0:00.17 bash
72 zhangxu 20 0 18904 2192 1524 R 0.0 0.0 0:00.17 top
3、按e 可变更显示内存的单位,顺序为 k > M > G > T > P
1 root 20 0 8892 308 276 S 0.0 0.0 0:00.09 init
6 root 20 0 8900 220 180 S 0.0 0.0 0:00.00 init
7 zhangxu 20 0 18364 4048 3948 S 0.0 0.0 0:00.41 bash
369 zhangxu 20 0 18928 2168 1528 R 0.0 0.0 0:00.18 top
1 root 20 0 8.7m 0.3m 0.3m S 0.0 0.0 0:00.09 init
6 root 20 0 8.7m 0.2m 0.2m S 0.0 0.0 0:00.00 init
7 zhangxu 20 0 17.9m 4.0m 3.9m S 0.0 0.0 0:00.41 bash
369 zhangxu 20 0 18.5m 2.1m 1.5m R 0.0 0.0 0:00.18 top
4、t 修改cpu使用率显示模式为进度条
top - 17:13:02 up 22 min, 0 users, load average: 0.52, 0.58, 0.59
Tasks: 4 total, 1 running, 3 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.1/4.3 7[||||||| ]
MiB Mem : 32669.6 total, 21765.0 free, 10680.6 used, 224.0 buff/cache
MiB Swap: 98304.0 total, 98282.4 free, 21.6 used. 21858.4 avail Mem
5、
未完待续
标签:改变 ide cache top init and iso command user
原文地址:https://www.cnblogs.com/devopsxu/p/13066912.html