使用 sar -c 命令可显示系统调用统计信息。oracle
$ sar -c00:00:00 scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s01:00:00 38 2 2 0.00 0.00 149 120 |
如下示例显示 sar -c 命令的输出。ide
$ sar -cSunOS balmyday 5.10 s10_51 sun4u 03/18/200400:00:04 scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s01:00:00 89 14 9 0.01 0.00 2906 239402:00:01 89 14 9 0.01 0.00 2905 239303:00:00 89 14 9 0.01 0.00 2908 239304:00:00 90 14 9 0.01 0.00 2912 239305:00:00 89 14 9 0.01 0.00 2905 239306:00:00 89 14 9 0.01 0.00 2905 239307:00:00 89 14 9 0.01 0.00 2905 239308:00:00 89 14 9 0.01 0.00 2906 239308:20:00 90 14 9 0.01 0.01 2914 239508:40:01 90 14 9 0.01 0.00 2914 239609:00:00 90 14 9 0.01 0.01 2915 239609:20:00 90 14 9 0.01 0.01 2915 239609:40:00 880 207 156 0.08 0.08 26671 929010:00:00 2020 530 322 0.14 0.13 57675 3639310:20:00 853 129 75 0.02 0.01 10500 859410:40:00 2061 524 450 0.08 0.08 579217 56707211:00:00 1658 404 350 0.07 0.06 1152916 1144203Average 302 66 49 0.02 0.01 57842 55544 |
下表介绍了 -c 选项报告的系统调用类别。一般,读取和写入占系统调用总数的一半。可是,该百分比会因系统所执行的活动而产生极大的变化。spa
字段名 视频 |
说明 教程 |
---|---|
scall/s队列 |
每秒中全部类型的系统调用数,在具备 4 到 6 位用户的系统中,一般每秒大约有 30 个系统调用。 ci |
sread/sget |
每秒的 read 系统调用数。it |
swrit/stable |
每秒的 write 系统调用数。 |
fork/s |
每秒的 fork 系统调用数,在具备 4 到6 位用户的系统中,每秒中大约有 0.5 个该系统调用。若是正在运行 Shell 脚本,此数字会增长。 |
exec/s |
每秒的 exec 系统调用数。若是 exec/s 除以 fork/s 的结果大于 3,请肯定是否存在无效的 PATH变量。 |
rchar/s |
每秒由 read 系统调用传送的字符数(字节)。 |
wchar/s |
每秒由 write 系统调用传送的字符数(字节)。 |
如何检查磁盘活动 (sar -d)
使用 sar -d 命令可显示磁盘活动统计信息。
$ sar -d00:00:00 device %busy avque r+w/s blks/s avwait avserv |
此缩写示例演示了 sar -d 命令的输出。
$ sar -dSunOS balmyday 5.10 s10_51 sun4u 03/18/200412:36:32 device %busy avque r+w/s blks/s avwait avserv12:40:01 dad1 15 0.7 26 399 18.1 10.0 dad1,a 15 0.7 26 398 18.1 10.0 dad1,b 0 0.0 0 1 1.0 3.0 dad1,c 0 0.0 0 0 0.0 0.0 dad1,h 0 0.0 0 0 0.0 6.0 fd0 0 0.0 0 0 0.0 0.0 nfs1 0 0.0 0 0 0.0 0.0 nfs2 1 0.0 1 12 0.0 13.2 nfs3 0 0.0 0 2 0.0 1.9 nfs4 0 0.0 0 0 0.0 7.0 nfs5 0 0.0 0 0 0.0 57.1 nfs6 1 0.0 6 125 4.3 3.2 nfs7 0 0.0 0 0 0.0 6.0 sd1 0 0.0 0 0 0.0 5.4 ohci0,bu 0 0.0 0 0 0.0 0.0 ohci0,ct 0 0.0 0 0 0.0 0.0 ohci0,in 0 0.0 7 0 0.0 0.0 ohci0,is 0 0.0 0 0 0.0 0.0 ohci0,to 0 0.0 7 0 0.0 0.0 |
下表介绍了 -d 选项报告的磁盘设备活动。
字段名 |
说明 |
---|---|
device |
监视的磁盘设备的名称。 |
%busy |
设备忙于为传送请求提供服务的时间份额。 |
avque |
设备忙于为传送请求提供服务期间的平均请求数。 |
r+w/s |
每秒对设备进行的读取和写入传送数。 |
blks/s |
每秒传送给设备的 512 字节块的数量。 |
avwait |
传送请求在队列中空闲等待的平均时间,以毫秒为单位。仅当队列被占用时才测量此时间。 |
avserv |
设备完成传送请求所需的平均时间,以毫秒为单位。对于磁盘而言,此值包括查找时间、旋转延迟时间和数据传送时间。 |
请注意,在队列不为空时测量队列长度和等待时间。当 %busy 很小时,若是队列和服务时间很大,则可能表示系统进行周期性的努力,以确保将警报块快速写入磁盘。
oracle视频教程请关注:http://down.51cto.com/4202939/up