Chinaunix首页 | 论坛 | 博客
  • 博客访问: 226441
  • 博文数量: 51
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 211
  • 用 户 组: 普通用户
  • 注册时间: 2013-08-05 23:07
文章分类

全部博文(51)

文章存档

2016年(11)

2015年(14)

2014年(4)

2013年(22)

我的朋友

分类: 系统运维

2016-01-26 17:58:17

iostat - I/O Statistics Reporter

?    Developed by Berkeley.

?    Reports disk activity statistics.

?    Compare to sar -d.

 

iostat是主要用来报告磁盘运行状态的工具,它的输出比sar –d可能更有用一些。

 

iostat给出CPU被IO占用的程度,还有发生在磁盘和终端上的IO的数量

 

iostat – Reporting Statistics

iostat每隔一个指定的时间间隔(interval)检查HPUX的内部计数器, 把结果输出到标准输出上。它会重复(count)次或是一直持续运行。如果interval没有给定,就只运行一次。第一行是从系统启动以来累计的结果,后续的行里是对应这个interval的结果。

 

对于每一个硬盘,iostat计算磁盘寻道与数据传输完成的数量和传输数据量的大小。每个硬盘的状态每秒钟检查HZ次(黄金甲按:原文如此,HZ是啥意思捏?),如果硬盘是活跃的,就会有它的一个统计值。iostat计算每个设备的平均寻址时间。通过这些数据,可以揭示IO瓶颈还有不同硬盘之间负载是否均衡。iostat报告每个硬盘而不是每个分区,所以swap区必须单独考虑。

 

如果指定-t参数,iostat会报告终端的输入输出字符数和全局的CPU活动。

 

利用硬盘的新技术如条带化,数据是分布在多个硬盘上的,平均寻址时间不太可能精确计算。所以,平均寻址时间(以毫秒为单位msps)被置为1.0

 

iostat – 示例

iostat 5 100 > iostat.out &

iostat -t 60 >      iostat.out &

iostat l

i  Reminder:  The first report line summarizes system activity since the last reboot.

在第一个例子里,报告数据时间间隔5秒,重复100次,输出被重定向到一个文件在后台运行。

 

第二个例子中,终端、CPU和硬盘的活动每分钟进行一次,一直重复下去。输出被重定向到一个文件中,在后台运行。这个过程直到进程被kill掉才会停下来。

 

最后一个例子会将硬盘的状态显示出来,每秒一次,一直进行。

 

使用iostat时,选择合适的时间间隔很重要。通常选择5秒钟,因为有些统计信息每5秒采样一次。

 

注意:第一行是从系统启动以来的平均值,所以通常可以忽略。

 

iostat 5 4

device

bps

sps

msps

c0t6d0

3

0.3

1

c0t5d0

2

0.1

1

c0t4d0

0

0

1

c0t6d0

30

3.4

1

c0t5d0

0

0

1

c0t4d0

0

0

1

c0t6d0

2

0.6

1

c0t5d0

3

0.4

1

c0t4d0

0

0

1

c0t6d0

12

1.2

1

c0t5d0

26

3.4

1

c0t4d0

0

0

1

 

 

这个例子每5秒报告一次,重复4次。系统中有3个磁盘c0t6d0, c0t5d0, and c0t4d0。bps是每秒传输了多少K字节,sps是每秒寻址的次数,msps是寻址的平均时间。上例中前两块硬盘比第三块要忙一些。

 

注意,第一行是平均值,请忽略它。

 

vmstat –Virtual Memory Statistics Reporter

?    Developed by Berkeley.

?    Reports virtual memory, process and CPU statistics.

Other optional uses

 

vmstat报告一些关于虚拟内存、进程、陷阱和CPU活动的统计信息。也可选地报告硬盘的活动,系统启动后fork和vfork的数量,每种fork操作引入的虚拟内存页面数量等

 

 

vmstat报告的方式与iostat类似。每隔interval秒重复count次。第一条记录是启动后的平均值,后面的每行是对应这个时间间隔的数值。

 

如果没有选项,vmstat会报告各个状态的进程数(在运行队列中,受阻的,可运行的/短时间sleep但是被swapped),虚拟内存与实际内存的使用情况(活动的虚拟内存页和free list的大小),paging活动的5秒平均情况(page reclaim,地址翻译错误,page in/page out等),每秒的陷阱与中断数量(设备中断,系统调用,CPU上下文切换率)还有CPU在user/system/idle模式下的使用率。

 

通过-S参数,vmstat会显示swap in和out的进程数,而不是页面数。通过-f参数,显示系统启动后的fork与vfork数和它们占用的虚拟页面数。-d选项,报告数据传输量每秒。-s参数,显示paging活动相关的sum数据结构。-z选项,清空sum数据结构中的数据。只有超级用户才可以用-z选项。

 

vmstat示例

vmstat -d 5 100 > vmstat.out &

vmstat -S 60 >    vmstat.out &

vmstat -fzs

vmstat l

vmstat

i  Reminder:  The first report line summarizes system activity since the last reboot.

第一个例子,硬盘信息以及进程、内存、系统调用、CPU信息每5秒一次,重复100次。输出重定向到一个文件,在后台运行。

 

第2个例子,显示swapping的信息。同样地,输出重定向在后台运行。这个命令只有在接到kill信号后才中止。

 

其他的命令显示了不同的选项,如果没有interval和count参数,只给出一行总和。

 

和用iostat一样,选择合适的时间间隔interval很重要。通常选5秒种。

 

#vmstat 5 5

procs

        memory

            page

  

      cpu

r   b   w    avm   free  re   at   pi   po   fr defacto sr   in   sy    cs    us    sy    id

2392  0  27578

  0  0     0   0     0    0    54       0    0   31    14    4     1     95

712921  29583       7  0    49 23  169 87    0     196 76 443  973    9   64     28

20843    34441       7  0    20 50    93 117  0     196 30 342  583  16   60     24

106331  38295       6  0    22 21    22  23   0     196 71 383 1743 16   53     31

58  045  40831       7  0    20 53    39  44   0     167 54 235 1381 18   47     35

51  072  25362   943 65   94 18      0    0   0        0  54 694 7502   2   35     43

436928  32149       7 60     4  7     78  42   0     176 53 541 1118  23  57     20

 

本例显示了一个标准的vmstat输出,没有指定其他参数。最重要的数据是活动的虚拟内存(avm)和空余列表大小free list size(free)。如果有大量的avm和非常少的free,内存就存在瓶颈。然后vmstat就应该用-S参数来检查是否在发生swapping.

 

注意:只有很少的free内存,但是活动的虚拟内存页维持在比较高的水平,说明有内存瓶颈。这会伴随着swapping操作,也会有大量的上下文切换,会有大量的进程在运行队列中或是受阻于资源,即使有很多idle的CPU时间

 

从这个例子还能看到,vmstat和iostat都有一个问题就是大的数字的显示,相近的列挤到一起很难阅读。

提醒:第一行应该被忽略。                                                                     

 

注意:使用-n选项,显示输出在80列显示的设备上更易阅读。这个格式把默认的输出分成两组:虚拟内存信息与CPU信息。 每一组单独一行显示。在多CPU系统中,也会按每个CPU单独显示利用率。

 

netstat Network Statistics Reporter

?    Network statistics.

?    Network bandwidth can affect performance  as much as CPU, memory or I/O.

Not as much extraneous information as iostat and vmstat

 

netstat提供网络相关的统计信息。因为网络带宽与性能有很大关联,就像CPU、内存与IO一样,你要对网络的流量有个概念。

 

netstat不像iostat与vmstat那样提供很多无关的信息。相反地,它的大部分输出是有用的。

 

netstat提供上次重起之后累积的数据。你可以使用不同的选项,也可以指定报告的时间间隔。通常你需要忽略第一行,因为这是系统重起后的累积值,通常系统最忙时候的数据是最有用的。

 

netstat –i

Name                 Mtu          Network  Address

lan0           1497                   151.150   a4410.e.h.c     

Ipkts         Ierrs                   Opkts       Oerrs        Col

242194     120            107665     23              19884

 

netstat –i显示自动配置的端口的状态。通常地,你想看lan0的信息,这个命令就有用。

 

Name: 网卡的名字,本例中是lan0

MTU: 最大传输单元Maximum transmission unit

Network: 配置的网络地址

Address:hostname,可以和/etc/hosts文件对照

Ipkts: 接收到的数据包的数量

Ierrs: 接收错误的数量

Opkts:发生的数据包数

Oerrs:发出过程中的错误

Col: 冲突Collisions的数量

 

netstat -I lan0 5

(lan0) -> input                   output

         packets   errs  packets       errs  colls      

         269841735         27         256627585          1         5092223

              1602          0              1238          0      49

              1223          0                   1048            0                   25

                   1516            0                   1151            0                   42

(Total) -> input         output

packets          errs          packets          errs  colls

281472199       27     268258048          1         5092223

     1673       0          1309          0              49

         1235         0              1060            0                   25

         1560         0              1195            0                   42

 

这个例子每5分钟提供网卡的信息。 第一个输出应该被忽略。

 

你可以指定网卡 –I (例子里是lan0),例子里还指定了1时间间隔5秒。

 

分析netstat的输出是比较直观的。要确定冲突Colls明显少于输出的数据包(Opkts). 冲突在传输数据时发生,冲突会降低网络性能。每有一个绝对的公式说多高的冲突是可接受的。但是,如果冲突小于输出数据包Opkts的5%,通常地说情况不错,你可以把注意力放到其他资源上面。如果这个值高的话,你可能要考虑把网络进行segment。

 

一般说来,如果你输入与输出的数据包越小,你的网络负载与冲突就越少。可以考虑使用’私有’网卡专门用于主机间的连接,另一块网卡用来连接到大的网络中。

 

netstat –r

Routing tables

Destination                      Gateway      Flags Refs Use   Interface Pmtu

hp700                                                                                  localhost     UH   0   28     lo0       4608

default                                                        router1       UG   0      0      lan0      4608

128.185.61                                             system1       U    347   28668 lan0     1500

 

netstat -rn

Routing tables

Destination                       Gateway     Flags Refs Use   Interface Pmtu

hp700                                                                                  127.0.0.1    UH   0    28    lo0       4608

default                               128.185.61.1 UG   0    0     lan0      4608

128.185.61                        128.185.61.2 U    347  28668 lan0      1500

 

还可以通过netstat获取路由相关的信息。-r选项显示路由表,-n选项用来显示网络地址而不是主机名。

 

-r选项显示了有关路由的信息,还有一个输出是Flags,它定义了路由的类型。下面是HPUX手册里描述的通常的Flags.

 

1=U: 通过主机自身路由到一个网络。

3=UG: 通过另外一台主机路由到一个网络。

5=UH: 通过主机自身路由到另一台主机。

7=UGH:通过另外一台主机路由到一台主机。

 

第一行是主机本身或是名为lo0的环回接口(地址127.0.0.1).UH标志说明目标地址是本机。A类的地址可以使同一台主机上的服务器与客户端通过TCP/IP通信。

 

第二行是默认路由。这一条是说如果没有特别指定的路径,就把数据包送到router1. 这时标志位flag为UG. 有些路由器配置为U,另外一些就像本例中配为UG。 尝试一下可以确认应该用哪种。 比如说你看到标志位为U,但是ping不通,那改成UG通常就解决问题。

 

第三行是网卡lan0. 要使用这个网卡,数据包要发往128.185.61网段。

 

lanadmin

?     Provides additional information related to network statistics.

?    Menu-driven.

?     

/usr/sbin/lanadmin 提供一些额外的网络信息。运行lanadmin时,出现一个菜单提示相关的选项,其中一个是显示网卡相关的信息。

 

lanadmin比netstat提供更多关于网卡的信息。网卡的类型,MTU,速度,运行状态还有网卡的硬件地址等。

 

lanadmin还提供更详细的报错信息。虽然任何类型的错误都会降低网络性能,对具体的错误与冲突了解多一些还是对解决问题有帮助。注意HPUX 11.0以后不再显示错误与冲突的信息。

 

通过lanadmin,你还可以使一块网卡复位,有时能在网络看起来不工作的情况下起作用,比如说网卡ping不通自己。

lanadmin菜单

LOCAL AREA NETWORK ADMINISTRATION

Test Selection mode.

                                                                                  lan         = LAN Interface Administration

                                                                               menu       = Display this menu

                                                                                 quit         = Terminate the Administration

                                                                               terse       = Do not display command menu

                                                    verbose = Display command menu

Enter command:  lan

 

这是一个输出的例子, lanadmin->lan->display:

LAN INTERFACE STATUS DISPLAY

Wed, Jan 12   16:03:57

Network Management ID                                 = 4

Description                                                                = lan1 Hewlett-Packard 10/100Base-TX Half Duplex HW Rev 0

Type (value)                                                               = ethernet-csmacd(6)

MTU Size                                                                    = 1500

Speed                                                                          = 10000000

Station Address                                                        = 0x80009d91067

Administration Status (value)                       = up (1)

Operation Status (value)                             = down (2)

Last Change                                                              = 0

Inbound Octets                                                        = 0

Inbound Unicast Packets                                   = 0

Inbound Discards                                                 = 0

Inbound Errors                                                         = 0

Inbound Unknown Protocols                             = 0

Outbound Octets                                                 = 0

Outbound Unicast Packets                                = 0

Outbound Discards                                              = 0

Outbound Errors                                                  = 0

Outbound Queue Length                                 = 0 ...

 

其他网络相关的命令

nfsstat :      NFS相关统计

nettune:            网络调整

ndd:                    网络动态调整

ping:                   测试ICMP echo

 

time/ timex

time命令很简单,可以用来测量过程的时间。它执行命令,结束后显示命令所耗时间(在system mode,user mode).

 

有几个不同版本的time命令。 /bin下面有time命令,还有csh time, ksh time. /usr/bin下有timex. timex是增加版本,可以报告一些相关资源的信息。最常用的是/bin/time.

 

注意:time/timex是HPUX特有的工具。

 

time如何工作?

?    Calls times(2) & stores to buffer “before”.

?    Forks a process.

?    Executes command.

?    Calls times(2) & stores to buffer “after”.

?    Calculates time.

 

time命令首先进行一个系统调用times,times报告进程及它的子进程在usr/sys模式下的时间,存在一个叫’before’的buffer中。然后它fork一个进程,执行命令。子进程结束后,也就是用户指定的命令结束后,time再进行一个系统调用times,把结果存在另一个buffer中’after’. 比较’before’与’after’中的时间,显示出来。

 

timex加上-s选项可以报告命令运行其间的系统活动情况,相当于sar –A的输出。

 

time示例

time w

10:17am up 5 days, 15:23     4 users, load average: 0.69, 0.49, 0.49

User          tty    login@               idle   JPCU         PCPU        what

blewis       d1p0         12:12pm      1       6:13    50       sleep 59

atanu        d1p2         9:31am    15              1              -csh

mat  d2t1 9:05am          1:06             1        1     mailx

mikec        d12p2 10:00am            3            1                   -ksh

real  3.4

user .05

sys   2.6

 

 

这个命令中,w命令被执行。标准的输出包含了总体时间消耗(3.4),用户模式(0.5),系统模式(2.6). 与预期的一样,大部分时间用在系统模式。

 

对一个特定的进程,观察它在如何使用系统时间是很不错的。

 

NOTE:time是一个很好的工具来建立一个baseline.

 

ps – Process Status

?    Reports on currently active processes.

?    Several options available.

?    Full listing (-f) and long listing (-l) available.

ps是最经常用到的命令之一。它允许用户检查自己的进程、其他用户的进程与系统进程的状态。

 

最常使用ps是不加参数,或是加上-f参数。但是,对于性能监控,-l选项特别有用。

 

没有选项时,ps显示只与当前终端相关的进程。 还有选项指定所有进程(-e),指定进程(-p), 指定用户(-u),指定用户组(-g). 还可以用完全显示(-f)与长格式显示(-l).

 

ps – l

F  S  UID  PID  PPID  C  PRI  NI  ADDR    SZ   WCHAN   TTY  TIME COMD

1  S    0      119        1   0  168  20 7d9870   584  1A96070   tty3p5    0:01  ksh

1  S    0      417    406 59  202  25 7ddae0 3264               tty3p5    0:00  stan2

1  R    0      292    110  0  168  20 ae7550  8324  1a97550    tty3p5    0:19  memlock

1  S    0      400     000  2  158  20 eee230   500   1ef82c      tty3p5     0:00  sh

1  R    0      418    406 12  181  20 adcf10   424                    tty3p5     0:00  ps  

 

F (Flags)   Meaning

0       swapped 被交换

1       in core 在核心

2       system process 系统进程

4       locked in core 锁定在核心

200  waiting 等待

S (Status) Meaning

O      non-existant  不存在

S       sleeping 休眠

W     waiting 等待

R       running 运行

Z       zombie () 僵尸

PRI (Priority)

NI (Nice Value) 

 Range from 0-20.

 

kill

如果ps命令显示一个进程处在hung挂起状态,可以用kill命令。 kill命令是一个工具,它对指定的进程发送信号。最普通的信号是’SIGKILL’使进程终止。除了发送信号之外,还可以发送信号的数字。

 

Signal Number         Signal

0                SIGNULL

1                SIGHUP

2                SIGINT

3                SIGQUIT

9                SIGKILL

15              SIGTERM

24              SIGSTOP

25              SIGTSTP

26              SIGCONT

showmount

showmount显示挂载了本地文件系统的所有的客户端。它可以用来确定哪些文件系统经常被通过NFS挂载。它的输出很容易读,包含了客户端与被客户端mount的目录。

 

NFS服务器经常服务于一些并没有意图向其共享的客户端。这耗费了额外的资源。

 

showmount有下列选项:

-a      以 “name:directory”的格式显示.

-d      显示所有被客户端挂载的本地目录。

-e    显示进行了export的文件系统

 

showmount -a

hp100.ct.mp.com:/applic

hp101.ct.mp.com:/applic

hp102.ct.mp.com:/applic

hp103.ct.mp.com:/applic

hp104.ct.mp.com:/applic

hp105.ct.mp.com:/applic

hp106.ct.mp.com:/applic

hp107.ct.mp.com:/applic

hp108.ct.mp.com:/applic

hp109.ct.mp.com:/applic

showmount -d

/applic

showmount -e

export list for server 101.cal.mp.com

/applic

 

swapinfo显示swap信息

?    How to estimate amount of required swap?

?    View the amount of swap being consumed with swapinfo.

如果系统内存不足以应付所需,它会将内存页挪到交换区或是将整个进程挪到交换区。最常被访问的内存页留在主内存中,不太常用的优先移出主内存。

 

很多系统管理员用很长时间研究多少交换空间swap space时合适的。这里没有一个一般参考值。可以根据下面几个因素来考虑:

:

?    应用程序建议用多少swap?

?    多少应用程序同时运行?如果有多个,把它们建议的swap空间加起来。

?     是否有NFS这样长期被使用的资源?NFS提供文件系统的访问,有些还很大,对swap空间有一定要求。

swapinfo

                     Kb              Kb         Kb       PCT

TYPE         AVAIL           USED       FREE    USED      

dev                49152                10532           38620          21%

reserve           -                     532360            -532360

memory            816360           469784            346576        58%

START/                             Kb   

 LIMIT                          RESERVE          PRI            NAME

          0                -          1                /dev/vg00/lvol2

 

TYPE:

dev – device

reserve – 保留的paging空间

memory – 如果paging空间都被使用了,可以有多少内存用来保存页面

 

         Kb AVAIL  以1024字节为单位,总共有多少swap空间,包含已用与未用的

Kb USED  现在用了多少块(1024字节为一块)

Kb FREE    Kb AVAIL – Kb USED

PCT USED 已使用的Kb除以总的Kb

 

START/

LIMIT        swap区开始的块地址

Kb

RESERVE “-“ 如果是设备类型的swap, 文件系统的swap这里会显示其kb大小

PRI            这个交换区的Priority

NAME       交换设备的设备名

 

其他选项:

-m 显示MB而不是KB

-d 只显示device swap信息

-f  只显示文件系统swap信息

-t  显示一行paging信息的总和

 

 

dmesg

?    Collect system diagnostic messages to form error log.

?    Messages created by unusual events (i.e. table overflows).

 

dmesg 将系统缓冲区中最近的诊断信息显示到标准输出上,比如说系统表溢出等。如果指定了”-“参数,dmesg计算上次运行之后的新的信息数,这个通常和cron结合来每隔10分钟运行.

/usr/sbin/dmesg - >> /var/adm/messages

 

 

dmesg

Jan 10 21:15

vuseg=1010000

  inet_clts:ok  inet_cots:ok

1 graph3

2 bus_adapter

2/0/1 c720

2/0/1.0 tgt

2/0/1.0.0 sdisk ...

Memory Information:

    physical page size = 4096 bytes, logical page size = 4096 bytes

    Physical: 196608 Kbytes, lockable: 141268 Kbytes, available: 165024 Kbytes

 

top

?    Berkeley-based.

?    Unsupported tool.

?    Displays the top CPU users on the system; periodically updates this information.

top 根据CPU占用率的顺序显示用户进程并定期更新。它使用未经处理的CPU占用率。top 可以使用下列选项:

-s time       设置屏幕更新的间隔到 time 秒. 默认的间隔是5秒。

-d count     只显示 count 屏,就退出。

-q       这个选项就相当于通过nice -20命令来运行top程序,这样它会执行得快一些。这在系统已经运行得很缓慢时有用。这个选项只有有权限的用户才能用。

 -u     显示User ID (uid)而不是用户名。这提高了运行速度因为不用将用户名与uid进行映射。

-n number 每屏只显示 number 个进程。如果这个值于每屏可显示的数量,就会被忽略。

top

System: m3145nxb                                      Mon Jan 10 21:39:51 2000

Load averages: 0.01, 0.01, 0.02

112 processes: 111 sleeping, 1 running

Cpu states:

 LOAD   USER   NICE    SYS   IDLE  BLOCK  SWAIT   INTR   SSYS

 0.01   0.0%   0.0%   0.0% 100.0%   0.0%   0.0%   0.0%   0.0%

Memory: 30140K (5152K) real, 30148K (10712K) virtual, 12396K free  Page# 1/8

 

TTY   PID USERNAME PRI NI   SIZE    RES STATE    TIME %WCPU  %CPU COMMAND

  p3  5033 root     158 20   460K   164K sleep    0:00  2.16  0.48 sh

  p3  5047 root     178 20   276K     0K run      0:00  4.10  0.39 top

  p3  5032 root     154 20    88K   168K sleep    0:00  0.62  0.16 telnetd

   ?     3 root     128 20     0K     0K sleep   30:58  0.12  0.12 statdaemon

   ?   334 root     154 20    24K    96K sleep   19:31  0.10  0.10 syncer

   ?  1129 root     154 20  6076K  1348K sleep   10:08  0.06  0.06 rpcd

   ?    19 root     100 20     0K     0K sleep    0:00  0.06  0.06 nvsisr

   ?   615 root     127 20   116K   328K sleep   14:06  0.04  0.04 netfmt

   ?    20 root     100 20     0K     0K sleep   12:57  0.03  0.03 supsched

   ?  1251 root     154 20   484K   244K sleep    8:15  0.03  0.03 Aserver

   ?     2 root     128 20     0K     0K sleep    0:08  0.02  0.02 vhand

   ?    14 root     153 20     0K     0K sleep    0:00  0.02  0.02 lvmkd

   ?    13 root     153 20     0K     0K sleep    0:00  0.02  0.02 lvmkd

   ?     7 root     -32 20     0K     0K sleep    0:00  0.02  0.02 ttisr

 

 

top提供了一个对系统的快速浏览,方便确定主要占用CPU资源的进程。也可以看到每个进程用了多少内存,是否用nice调整了运行优先级。

 

下列信息显示在屏幕上边,不同状态的进程数,不同模式下的CPU时间,正在使用的虚拟与物理内存数(括号里是活跃的数量)和剩余内存数。

 

注:标签BLOCK,SWAIT,SSYS是与semaphore,spinlock和swapping相关的。

 

然后,对每一个进程,显示了下列信息:

tty端口号(TTY),进程ID(PID),进程的owner(USERNAME),进程的优先级减去PZERO(153)(PRI),进程的nice值减去20(NI),进程的大小(text+data+stack)(SIZE),现在驻留在内存中的大小(RES),进程的状态(STATE),进程已使用的system和user时间(TIME),加权后的CPU百分比(%WCPU),未处理的CPU利用率(用来排序的)(%CPU),最后是命令的名字。

 

默认情况下每5秒钟更新这些统计信息。可以用top –s 10改在10秒。

 

top命令启动后,经常会top成为使用CPU最多的进程,占用10-11%,几次更新以后,占用率下降到2%左右。然而,如果太多用户同时使用top命令,系统资源会受到较大影响,所以对top的使用要有所控制。

 

其他有用的命令

?    size

?    nm

?    bdf

?    fuser

?    ipcs

?    uptime

下面的用得少,不译了。

 

size(1) is a useful tool for analyzing application programs.  It prints the section sizes of object files and reports the size of the text (sum of the sizes of all code segments), data size (sum of the initialized data segments), and the bss size (sum of the uninitialized data segments).  On the series 800 with the -v option, it prints a list of all subspaces to which the symbol belongs to.

nm(1) is another tool used for analyzing application programs.  It prints the name list of common object files; the symbol table; and for each symbol, the name of the symbol, its value expressed as an offset or an address depending on its storage class, the scope of the symbol (undefined, static, or external), its type (code, data, common, and so on), and the subspace to which the symbol belongs to.

bdf, the BSD version of df, reports the number of free disk blocks.  It prints out the amount of free disk space available on the specified file system or all the mounted file systems.  The reported numbers are in kilobytes.  With the -i option it will also report the number of used and free inodes.

fuser(1m) lists the PIDs of the processes using specified files or block file devices.  Options allow the users to be identified and the processes to be killed.

ipcs(1) reports information about active inter-process communication facilities, including active message queues, shared memory segments, and semaphores.  Note that the ipcrm(1) command may be used to remove class identifiers if required.

uptime(1) reports the current time; the length of time the system has been up; the number of users logged on; and the average number of jobs in run queues over the last 1, 5, and 15 minutes. (There is also an undocumented variant, w, which shows what current users are doing.)

审计工具

?    diskusg

?    fwtmp

?    last

?    acctcom

?    acctcms

The HP-UX system accounting tools provide the means to monitor disk usage for individual users, record connect resource utilization data (such as memory usage and execution times) for individual processes.  Besides being used for charging fees to specific users, it can be used to generate summary files and reports that can be used to analyze system performance.  The HP-UX system administrators guide describes these tools and their installation in detail.  If a customer is already using system accounting, a lot of performance related data can be extracted.  If not, there is the CPU and disk overhead related with these tools that must be considered.

 

Use acctcom to produce reports using the following options:

–  h          hog factor

–  i          amount of I/O

–  t system and user times

–  a          print averages

–  u          for specific user(s)

–  s start time

–  e          end time

–  n          process name (pattern)

–  H         hog factor exceeds value

–  O         system CPU time exceeds value

Use acctcms for a summary report.

Process reporting is very useful, but it can use up large amounts of disk space.  Normally, a time window to monitor is chosen, and process accounting is enabled by turnact on at the start andturnact off at the end.  If; however, continuous monitoring is required, ckpacct should be executed via cron hourly.

By default, acctcom produces a report with the following information:  command, user, ttyname, start time, end time, real (elapsed) time, CPU time, and mean memory size.

acctcms produces a summary report which needs to be executed with the -a option.  Its output should be sent to a line printer (more than 80 characters wide).

阅读(3682) | 评论(0) | 转发(0) |
0

上一篇:HPUX性能优化工具的使用 (2)

下一篇:没有了

给主人留下些什么吧!~~