Print this page
749 "/usr/bin/kstat" should be rewritten in C
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Brendan Gregg <brendan.gregg@joyent.com>
kstat

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1m/kstat.1m
          +++ new/usr/src/man/man1m/kstat.1m
   1    1  '\" te
   2    2  .\" Copyright (c) 2000, Sun Microsystems, Inc. All Rights Reserved
   3    3  .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
   4    4  .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with
   5    5  .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   6      -.TH KSTAT 1M "Mar 23, 2009"
        6 +.TH KSTAT 1M "Nov 22, 2012"
   7    7  .SH NAME
   8    8  kstat \- display kernel statistics
   9    9  .SH SYNOPSIS
  10   10  .LP
  11   11  .nf
  12      -\fBkstat\fR [\fB-lpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR] [\fB-m\fR \fImodule\fR]
       12 +\fBkstat\fR [\fB-Cjlpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR] [\fB-m\fR \fImodule\fR]
  13   13       [\fB-i\fR \fIinstance\fR] [\fB-n\fR \fIname\fR] [\fB-s\fR \fIstatistic\fR]
  14   14       [interval [count]]
  15   15  .fi
  16   16  
  17   17  .LP
  18   18  .nf
  19      -\fBkstat\fR [\fB-lpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR]
       19 +\fBkstat\fR [\fB-Cjlpq\fR] [\fB-T\fR u | d ] [\fB-c\fR \fIclass\fR]
  20   20       [\fImodule\fR:\fIinstance\fR:\fIname\fR:\fIstatistic\fR]...
  21   21       [interval [count]]
  22   22  .fi
  23   23  
  24   24  .SH DESCRIPTION
  25   25  .sp
  26   26  .LP
  27   27  The \fBkstat\fR utility examines the available kernel statistics, or kstats, on
  28   28  the system and reports those statistics which match the criteria specified on
  29   29  the command line. Each matching statistic is printed with its module, instance,
↓ open down ↓ 22 lines elided ↑ open up ↑
  52   52  .SH OPTIONS
  53   53  .sp
  54   54  .LP
  55   55  The tests specified by the following options are logically ANDed, and all
  56   56  matching kstats will be selected. A regular expression containing shell
  57   57  metacharacters must be protected from the shell by enclosing it with the
  58   58  appropriate quotes.
  59   59  .sp
  60   60  .LP
  61   61  The argument for the \fB-c\fR, \fB-i\fR, \fB-m\fR, \fB-n\fR, and \fB-s\fR
  62      -options may be specified as a shell glob pattern, or a Perl regular expression
  63      -enclosed in '/' characters.
       62 +options may be specified as a shell glob pattern.
       63 +.sp
       64 +.ne 2
       65 +.na
       66 +\fB\fB-C\fR\fR
       67 +.ad
       68 +.RS 16n
       69 +Displays output in parseable format with a colon as separator.
       70 +.RE
       71 +
  64   72  .sp
  65   73  .ne 2
  66   74  .na
  67   75  \fB\fB-c\fR \fIclass\fR\fR
  68   76  .ad
  69   77  .RS 16n
  70   78  Displays only kstats that match the specified class. \fIclass\fR is a
  71   79  kernel-defined string which classifies the "type" of the kstat.
  72   80  .RE
  73   81  
↓ open down ↓ 2 lines elided ↑ open up ↑
  76   84  .na
  77   85  \fB\fB-i\fR \fIinstance\fR\fR
  78   86  .ad
  79   87  .RS 16n
  80   88  Displays only kstats that match the specified instance.
  81   89  .RE
  82   90  
  83   91  .sp
  84   92  .ne 2
  85   93  .na
       94 +\fB\fB-j\fR\fR
       95 +.ad
       96 +.RS 16n
       97 +Displays output in JSON format.
       98 +.RE
       99 +
      100 +.sp
      101 +.ne 2
      102 +.na
  86  103  \fB\fB-l\fR\fR
  87  104  .ad
  88  105  .RS 16n
  89  106  Lists matching kstat names without displaying values.
  90  107  .RE
  91  108  
  92  109  .sp
  93  110  .ne 2
  94  111  .na
  95  112  \fB\fB-m\fR \fImodule\fR\fR
↓ open down ↓ 58 lines elided ↑ open up ↑
 154  171  The following operands are supported:
 155  172  .sp
 156  173  .ne 2
 157  174  .na
 158  175  \fB\fImodule\fR:\fIinstance\fR:\fIname\fR:\fIstatistic\fR\fR
 159  176  .ad
 160  177  .sp .6
 161  178  .RS 4n
 162  179  Alternate method of specifying module, instance, name, and statistic as
 163  180  described above. Each of the module, instance, name, or statistic specifiers
 164      -may be a shell glob pattern or a Perl regular expression enclosed by '/'
 165      -characters. It is possible to use both specifier types within a single operand.
      181 +may be a shell glob pattern.
      182 +It is possible to use both specifier types within a single operand.
 166  183  Leaving a specifier empty is equivalent to using the '*' glob pattern for that
 167  184  specifier.
 168  185  .RE
 169  186  
 170  187  .sp
 171  188  .ne 2
 172  189  .na
 173  190  \fB\fIinterval\fR\fR
 174  191  .ad
 175  192  .sp .6
↓ open down ↓ 19 lines elided ↑ open up ↑
 195  212  course vary from machine to machine.
 196  213  .LP
 197  214  \fBExample 1 \fRUsing the \fBkstat\fR Command
 198  215  .sp
 199  216  .in +2
 200  217  .nf
 201  218  example$ \fBkstat -p -m unix -i 0 -n system_misc -s 'avenrun*'\fR
 202  219  example$ \fBkstat -p -s 'avenrun*'\fR
 203  220  example$ \fBkstat -p 'unix:0:system_misc:avenrun*'\fR
 204  221  example$ \fBkstat -p ':::avenrun*'\fR
 205      -example$ \fBkstat -p ':::/^avenrun_\ed+min$/'\fR
      222 +example$ \fBkstat -p ':::avenrun*min$'\fR
 206  223  
 207  224  unix:0:system_misc:avenrun_15min        3
 208  225  unix:0:system_misc:avenrun_1min 4
 209  226  unix:0:system_misc:avenrun_5min 2
 210  227  .fi
 211  228  .in -2
 212  229  .sp
 213  230  
 214  231  .LP
 215  232  \fBExample 2 \fRUsing the \fBkstat\fR Command
 216  233  .sp
 217  234  .in +2
 218  235  .nf
 219  236  example$ \fBkstat -p -m cpu_stat -s 'intr*'\fR
 220      -example$ \fBkstat -p cpu_stat:::/^intr/\fR
      237 +example$ \fBkstat -p 'cpu_stat:::intr*'\fR
 221  238  
 222  239  cpu_stat:0:cpu_stat0:intr       29682330
 223  240  cpu_stat:0:cpu_stat0:intrblk    87
 224  241  cpu_stat:0:cpu_stat0:intrthread 15054222
 225  242  cpu_stat:1:cpu_stat1:intr       426073
 226  243  cpu_stat:1:cpu_stat1:intrblk    51
 227  244  cpu_stat:1:cpu_stat1:intrthread 289668
 228  245  cpu_stat:2:cpu_stat2:intr       134160
 229  246  cpu_stat:2:cpu_stat2:intrblk    0
 230  247  cpu_stat:2:cpu_stat2:intrthread 131
↓ open down ↓ 3 lines elided ↑ open up ↑
 234  251  .fi
 235  252  .in -2
 236  253  .sp
 237  254  
 238  255  .LP
 239  256  \fBExample 3 \fRUsing the \fBkstat\fR Command
 240  257  .sp
 241  258  .in +2
 242  259  .nf
 243  260  example$ \fBkstat -p :::state ':::avenrun*'\fR
 244      -example$ \fBkstat -p :::state :::/^avenrun/\fR
 245  261  
 246  262  cpu_info:0:cpu_info0:state      on-line
 247  263  cpu_info:1:cpu_info1:state      on-line
 248  264  cpu_info:2:cpu_info2:state      on-line
 249  265  cpu_info:3:cpu_info3:state      on-line
 250  266  unix:0:system_misc:avenrun_15min        4
 251  267  unix:0:system_misc:avenrun_1min 10
 252  268  unix:0:system_misc:avenrun_5min 3
 253  269  .fi
 254  270  .in -2
↓ open down ↓ 105 lines elided ↑ open up ↑
 360  376  
 361  377  .SH SEE ALSO
 362  378  .sp
 363  379  .LP
 364  380  \fBdate\fR(1), \fBsh\fR(1), \fBtime\fR(2), \fBgmatch\fR(3GEN),
 365  381  \fBkstat\fR(3KSTAT), \fBattributes\fR(5), \fBkstat\fR(7D), \fBsd\fR(7D),
 366  382  \fBkstat\fR(9S)
 367  383  .SH NOTES
 368  384  .sp
 369  385  .LP
 370      -If the pattern argument contains glob or Perl RE metacharacters which are also
      386 +If the pattern argument contains glob metacharacters which are also
 371  387  shell metacharacters, it will be necessary to enclose the pattern with
 372  388  appropriate shell quotes.
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX