1.top查看多cpu
# top top - 14:09:24 up 155 days, 21:50, 1 user, load average: 0.24, 0.18, 0.24 Tasks: 108 total, 1 running, 107 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 501016k total, 490896k used, 10120k free, 244k buffers Swap: 490488k total, 352784k used, 137704k free, 37312k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 16316 mysql 20 0 709m 8092 2656 S 0.3 1.6 76:25.10 mysqld 25265 root 20 0 285m 180 108 S 0.3 0.0 55:47.00 php-fpm 1 root 20 0 19220 332 208 S 0.0 0.1 0:30.14 init 2 root 20 0 0 0 0 S 0.0 0.0 0:01.03 kthreadd 3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 4 root 20 0 0 0 0 S 0.0 0.0 0:47.14 ksoftirqd/0 5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
按1 显示多cpu,再按1退出多cpu
按W,将配置保存为/root/.toprc文件
用已保存的模式打开top会显示多个cpu
2.一次静态输出多个cpu结果
# top -bn1 //查看所有进程-b是非交互模式,-n设置只输出一次信息 top – 16:51:56 up 8 days, 2:35, 1 user, load average: 0.00, 0.01, 0.53 Tasks: 112 total, 1 running, 111 sleeping, 0 stopped, 0 zombie Cpu0 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu1 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu2 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu3 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
3.持续查看某pid的cpu,内存使用量
# top -p 1122 //或watch "ps aux | grep 1122",此处假设pid为1122
转载自:top查看多cpu:http://coolnull.com/1978.html
0 条评论。