top VS atop VS htop

Atop 是一个基于 ASCII 的全屏的性能监控工具,可用来监控进程的活动时间,高亮显示出一些过载的进程,还包括其他的一些系统指标例如:CPU、内存、交换分区、磁盘和网络等信息。
常用操作,c键显示命令行;d键显示磁盘io状况;m键显示内存;s键显示进程;v键详细显示;u键启动账户信息;n键网卡信息,一般需要内核支持;
C键cpu排序;M键内存排序;D键磁盘排序;N键网卡流量排序;
atop可以保存日志文件,便于后期读取查看,atop -r atop_20121212,启动后默认有计划任务,每天一个日志。

htop——一个可以让用户与之交互的进程查看器。作为文本模式的应用程序,主要用于控制台或 X 终端中。当前具有按树状方式来查看进程,支持颜色主题,可以定制等特性。
与 top 相比,htop 包含的优点有:
可以横向或纵向滚动浏览进程列表,以便看到所有的进程和完整的命令行。
在启动上,比 top 更快。
杀进程时不需要输入进程号。
htop 支持鼠标操作。
top 已经很老了。

[root@localhost ~]# yum install atop
Loaded plugins: fastestmirror, priorities
Determining fastest mirrors
* epel: mirror.bjtu.edu.cn
addons | 951 B 00:00
base | 2.1 kB 00:00
epel | 3.4 kB 00:00
extras | 2.1 kB 00:00
updates | 1.9 kB 00:00
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
–> Running transaction check
—> Package atop.x86_64 0:1.26-1.el5.2 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
atop x86_64 1.26-1.el5.2 epel 111 k

Transaction Summary
========================================================================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 111 k
Is this ok [y/N]: y
Downloading Packages:
atop-1.26-1.el5.2.x86_64.rpm | 111 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : atop 1/1

Installed:
atop.x86_64 0:1.26-1.el5.2

Complete!
[root@localhost ~]# yum install htop
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* epel: mirror.bjtu.edu.cn
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
–> Running transaction check
—> Package htop.x86_64 0:0.8.3-1.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
htop x86_64 0.8.3-1.el5 epel 68 k

Transaction Summary
========================================================================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 68 k
Is this ok [y/N]: y
Downloading Packages:
htop-0.8.3-1.el5.x86_64.rpm | 68 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : htop 1/1

Installed:
htop.x86_64 0:0.8.3-1.el5

Complete!
[root@localhost ~]# atopsar -c 60 5

localhost 2.6.18-164.11.1.el5 #1 SMP Wed Jan 20 07:32:21 EST 2010 x86_64 2012/03/28

————————– analysis date: 2012/03/28 ————————–

09:40:55 cpu %usr %nice %sys %irq %softirq %steal %guest %wait %idle _cpu_
09:41:55 all 0 0 0 0 0 0 0 0 800
0 0 0 0 0 0 0 0 0 100
1 0 0 0 0 0 0 0 0 100
2 0 0 0 0 0 0 0 0 100
3 0 0 0 0 0 0 0 0 100
4 0 0 0 0 0 0 0 0 100
5 0 0 0 0 0 0 0 0 100
6 0 0 0 0 0 0 0 0 100
7 0 0 0 0 0 0 0 0 100

[root@localhost ~]# htop

1 [ 0.0%] Tasks: 70 total, 1 running
2 [| 0.7%] Load average: 0.01 0.02 0.00
3 [ 0.0%] Uptime: 147 days(!), 17:16:35
4 [| 0.7%]
5 [ 0.0%]
6 [ 0.0%]
7 [ 0.0%]
8 [ 0.0%]
Mem[|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||502/7976MB]
Swp[| 6/9983MB]

PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
11135 root 15 0 15392 1364 944 R 0.0 0.0 0:00.30 htop
1 root 15 0 10348 636 540 S 0.0 0.0 0:38.25 init [3]
831 root 12 -4 12672 840 392 S 0.0 0.0 0:00.16 /sbin/udevd -d
1709 root 18 0 368M 30972 7340 S 0.0 0.4 0:00.46 /usr/sbin/httpd
2249 root 20 0 65952 1284 1076 S 0.0 0.0 0:00.00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –socket=/var/lib/mysql/mysql.sock –log-error=/var
2299 mysql 18 0 391M 47656 5412 S 0.0 0.6 0:08.42 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2301 mysql 16 0 391M 47656 5412 S 0.0 0.6 0:00.00 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2302 mysql 16 0 391M 47656 5412 S 0.0 0.6 0:00.22 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2303 mysql 16 0 391M 47656 5412 S 0.0 0.6 0:17.16 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2304 mysql 15 0 391M 47656 5412 S 0.0 0.6 6:46.74 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2306 mysql 15 0 391M 47656 5412 S 0.0 0.6 0:00.00 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2307 mysql 15 0 391M 47656 5412 S 0.0 0.6 0:00.00 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2308 mysql 15 0 391M 47656 5412 S 0.0 0.6 1h01:21 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2309 mysql 15 0 391M 47656 5412 S 0.0 0.6 0:55.24 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2310 mysql 19 0 391M 47656 5412 S 0.0 0.6 0:00.00 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysql
2737 root 18 0 10124 624 520 S 0.0 0.0 0:00.00 pptpd -c /etc/pptpd.conf
2789 root 11 -4 92892 944 588 S 0.0 0.0 0:28.76 auditd
2790 root 12 -4 92892 944 588 S 0.0 0.0 3:34.93 auditd
2791 root 7 -8 143M 1008 624 S 0.0 0.0 0:13.72 /sbin/audispd
2792 root 7 -8 143M 1008 624 S 0.0 0.0 0:11.80 /sbin/audispd
2821 root 15 0 5908 704 564 S 0.0 0.0 1:31.96 syslogd -m 0
2824 root 15 0 3804 432 348 S 0.0 0.0 0:00.00 klogd -x
2838 root 18 0 10760 376 244 S 0.0 0.0 0:41.61 irqbalance
2927 root 18 0 48716 720 284 S 0.0 0.0 0:00.01 rpc.idmapd
2950 dbus 15 0 21364 1068 728 S 0.0 0.0 0:52.60 dbus-daemon –system
2993 root 20 0 21172 1364 548 S 0.0 0.0 0:00.12 pcscd
3026 root 18 0 21172 1364 548 S 0.0 0.0 0:02.75 pcscd
3007 root 18 0 3800 568 468 S 0.0 0.0 0:00.00 /usr/sbin/acpid
3020 haldaemo 15 0 31000 4072 1580 S 0.0 0.0 0:01.48 hald
3021 root 15 0 21692 1052 872 S 0.0 0.0 0:00.00 hald-runner
3029 haldaemo 19 0 12324 856 744 S 0.0 0.0 0:00.00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
3037 root 16 0 10228 688 592 S 0.0 0.0 32:25.65 hald-addon-storage: polling /dev/scd0
[root@localhost ~]# atop

cpu | sys 0% | user 0% | irq 0% | idle 100% | cpu007 w 0% | | steal 0% | guest 0% | curf 2.26GHz | curscal ?% |
cpu | sys 0% | user 0% | irq 0% | idle 100% | cpu006 w 0% | | steal 0% | guest 0% | curf 2.26GHz | curscal ?% |
ATOP – localhost 2012/03/28 09:44:30 —— 10s elapsed
PRC | sys 0.01s | user 0.01s | #proc 153 | #trun 1 | #tslpi 169 | #tslpu 0 | #zombie 0 | clones 5 | | #exit 2 |
CPU | sys 0% | user 0% | irq 0% | idle 800% | wait 0% | | steal 0% | guest 0% | curf 2.26GHz | curscal ?% |
cpu | sys 0% | user 0% | irq 0% | idle 100% | cpu002 w 0% | | steal 0% | guest 0% | curf 2.26GHz | curscal ?% |
cpu | sys 0% | user 0% | irq 0% | idle 100% | cpu006 w 0% | | steal 0% | guest 0% | curf 2.26GHz | curscal ?% |
CPL | avg1 0.00 | avg5 0.01 | | avg15 0.00 | | csw 873 | intr 10299 | | | numcpu 8 |
MEM | tot 7.8G | free 783.4M | cache 6.2G | dirty 0.1M | buff 336.1M | slab 297.3M | | | | |
SWP | tot 9.7G | free 9.7G | | | | | | | vmcom 670.8M | vmlim 13.6G |
LVM | p00-LogVol00 | busy 0% | read 0 | write 25 | KiB/r 0 | KiB/w 4 | MBr/s 0.00 | MBw/s 0.01 | avq 6.25 | avio 1.12 ms |
DSK | sda | busy 0% | read 0 | write 4 | KiB/r 0 | KiB/w 25 | MBr/s 0.00 | MBw/s 0.01 | avq 1.00 | avio 7.00 ms |
NET | transport | tcpi 53 | tcpo 50 | udpi 2 | udpo 2 | tcpao 0 | tcppo 2 | tcprs 0 | tcpie 0 | udpip 0 |
NET | network | ipi 57 | ipo 54 | ipfrw 0 | deliv 56 | | | | icmpi 0 | icmpo 2 |
NET | eth0 0% | pcki 136 | pcko 56 | si 7 Kbps | so 4 Kbps | coll 0 | erri 0 | erro 0 | drpi 0 | drpo 0 |

PID RUID EUID THR SYSCPU USRCPU VGROW RGROW RDDSK WRDSK ST EXC S CPUNR CPU CMD 1/1
11150 root root 1 0.01s 0.01s 0K 0K 0K 0K — – R 6 0% atop
2299 mysql mysql 10 0.00s 0.00s 0K 0K 0K 0K — – S 7 0% mysqld
32556 root root 2 0.00s 0.00s 0K 0K 0K 0K — – S 7 0% snmpd
3123 root root 5 0.00s 0.00s 0K 0K 0K 0K — – S 4 0% automount
6004 root root 1 0.00s 0.00s 0K 0K 0K 0K — – S 7 0% vsftpd
2838 root root 1 0.00s 0.00s 0K 0K 0K 0K — – S 5 0% irqbalance
773 root root 1 0.00s 0.00s 0K 0K 0K 72K — – S 1 0% kjournald
? nobody – 0 0.00s 0.00s 0K 0K – – NE 0 E – 0%
? root – 0 0.00s 0.00s 0K 0K – – NE 0 E – 0%

参考:
http://htop.sourceforge.net/index.php?page=downloads
http://www.atoptool.nl/index.php

One Reply to “top VS atop VS htop”

发表评论

电子邮件地址不会被公开。 必填项已用*标注