跳过导航链接 | |
退出打印视图 | |
手册页第 1M 部分:系统管理命令 Oracle Solaris 11.1 Information Library (简体中文) |
- 显示内核统计信息
kstat [-lpq] [-T u | d ] [-c class] [-m module] [-i instance] [-n name] [-s statistic] [interval [count]]
kstat [-lpq] [-T u | d ] [-c class] [module:instance:name:statistic]... [interval [count]]
kstat 实用程序用于检查系统中的可用内核统计信息(或 kstat),并报告与命令行上指定的条件匹配的统计信息。列显每条匹配的统计信息时,将会同时列显其模块、实例和名称字段以及实际值。
内核统计信息可以通过各种内核子系统(例如驱动程序或可装入的模块)进行发布;每个 kstat 都有一个用于指示其发布者的模块字段。由于每个模块都可能具有要报告其统计信息的可计数实体(例如与 sd(7D) 驱动程序关联的多个磁盘),因此 kstat 还具有一个为每个实体的统计信息编制索引的实例字段;kstat 实例从零开始编号。最后,为 kstat 指定了一个在其模块内唯一的名称。
每个 kstat 都可能是一种特殊的 kstat 类型、名称-值对数组或原始数据。在名称-值情况下,每个报告值都会被指定一个称为统计信息的标签。kstat 会为已知的原始 kstat 和特殊 kstat 的每个值指定统计信息标签;因此,所有已发布的值都可以引用为 module:instance:name:statistic。
如果在没有任何模块操作数或选项的情况下进行调用,kstat 将会与系统中定义的所有统计信息匹配。下面提供了示例调用。自系统引导以来,所有时间均显示为小数秒。
以下选项指定的测试执行逻辑 AND 运算,将选择所有匹配的 kstat。必须用合适的引号将包含 shell 元字符的正则表达式引起来,以免被 shell 调用。
可以将 -c、-i、-m、-n 和 -s 选项的参数指定为 shell glob 模式,也可以指定为用 '/' 字符括起来的 Perl 正则表达式。
仅显示与指定的类匹配的 kstat。class 为内核定义的用于对 kstat 的“类型”进行分类的字符串。
仅显示与指定的实例匹配的 kstat。
列出匹配的 kstat 名称,而不显示值。
仅显示与指定的模块匹配的 kstat。
仅显示与指定的名称匹配的 kstat。
以可解析的格式显示输出。本文档中的所有示例输出都是以此格式提供的。如果未指定此选项,kstat 将会以用户可读的表格式生成输出。
不显示输出,而返回与给定条件匹配的项目的相应退出状态。
仅显示与指定的统计信息匹配的 kstat。
以 date(1) 格式 (d) 或以 time(2) (u) 返回的值的字母数字表示形式,在每个统计信息块之前显示一个时间戳。
支持下列操作数:
按照以上所述指定模块、实例、名称和统计信息的备用方法。每个模块、实例、名称或统计信息说明符都可以为 shell glob 模式,也可以为用 '/' 字符括起来的 Perl 正则表达式。可以在一个操作数内使用两种说明符类型。将说明符保留为空等效于对该说明符使用 '*' glob 模式。
两次报告之前间隔的秒数。
要列显的报告数。
在以下示例中,块中的所有命令行都会生成相同的输出,如紧邻命令行的下方所示。当然,确切的统计信息和值将视计算机而异。
示例 1 使用 kstat 命令
example$ kstat -p -m unix -i 0 -n system_misc -s 'avenrun*' example$ kstat -p -s 'avenrun*' example$ kstat -p 'unix:0:system_misc:avenrun*' example$ kstat -p ':::avenrun*' example$ kstat -p ':::/^avenrun_\d+min$/' unix:0:system_misc:avenrun_15min 3 unix:0:system_misc:avenrun_1min 4 unix:0:system_misc:avenrun_5min 2
示例 2 使用 kstat 命令
example$ kstat -p -m cpu_stat -s 'intr*' example$ kstat -p cpu_stat:::/^intr/ cpu_stat:0:cpu_stat0:intr 29682330 cpu_stat:0:cpu_stat0:intrblk 87 cpu_stat:0:cpu_stat0:intrthread 15054222 cpu_stat:1:cpu_stat1:intr 426073 cpu_stat:1:cpu_stat1:intrblk 51 cpu_stat:1:cpu_stat1:intrthread 289668 cpu_stat:2:cpu_stat2:intr 134160 cpu_stat:2:cpu_stat2:intrblk 0 cpu_stat:2:cpu_stat2:intrthread 131 cpu_stat:3:cpu_stat3:intr 196566 cpu_stat:3:cpu_stat3:intrblk 30 cpu_stat:3:cpu_stat3:intrthread 59626
示例 3 使用 kstat 命令
example$ kstat -p :::state ':::avenrun*' example$ kstat -p :::state :::/^avenrun/ cpu_info:0:cpu_info0:state on-line cpu_info:1:cpu_info1:state on-line cpu_info:2:cpu_info2:state on-line cpu_info:3:cpu_info3:state on-line unix:0:system_misc:avenrun_15min 4 unix:0:system_misc:avenrun_1min 10 unix:0:system_misc:avenrun_5min 3
示例 4 使用 kstat 命令
example$ kstat -p 'unix:0:system_misc:avenrun*' 1 3 unix:0:system_misc:avenrun_15min 15 unix:0:system_misc:avenrun_1min 11 unix:0:system_misc:avenrun_5min 21 unix:0:system_misc:avenrun_15min 15 unix:0:system_misc:avenrun_1min 11 unix:0:system_misc:avenrun_5min 21 unix:0:system_misc:avenrun_15min 15 unix:0:system_misc:avenrun_1min 11 unix:0:system_misc:avenrun_5min 21
示例 5 使用 kstat 命令
example$ kstat -p -T d 'unix:0:system_misc:avenrun*' 5 2 Thu Jul 22 19:39:50 1999 unix:0:system_misc:avenrun_15min 12 unix:0:system_misc:avenrun_1min 0 unix:0:system_misc:avenrun_5min 11 Thu Jul 22 19:39:55 1999 unix:0:system_misc:avenrun_15min 12 unix:0:system_misc:avenrun_1min 0 unix:0:system_misc:avenrun_5min 11
示例 6 使用 kstat 命令
example$ kstat -p -T u 'unix:0:system_misc:avenrun*' 932668656 unix:0:system_misc:avenrun_15min 14 unix:0:system_misc:avenrun_1min 5 unix:0:system_misc:avenrun_5min 18
将返回以下退出值:
有一条或多条统计信息匹配。
无统计信息匹配。
指定的命令行选项无效。
发生了致命错误。
内核统计信息驱动程序
有关下列属性的说明,请参见 attributes(5):
|
date(1)、sh(1)、time(2)、gmatch(3GEN)、kstat(3KSTAT)、attributes(5)、kstat(7D)、sd(7D)、kstat(9S)
如果模式参数包含也为 shell 元字符的 glob 或 Perl RE 元字符,则必须用相应的 shell 引号将模式引起来。