Utilities for system statistics

Serge Vakulenko edited this page Dec 2, 2014 · 17 revisions

Utilities for system status and statistics

dmesg

# dmesg
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.

4.4BSD-Lite build 19 compiled 2014-11-16
    vak@kucha:LiteBSD/sys/compile/WIFIRE.pic32
cpu: PIC32MZ2048ECG100 rev A4, 200 MHz
oscillator: system PLL div 1:6 mult x50
real mem = 512 kbytes
avail mem = 336 kbytes
using 16 buffers containing 49152 bytes of memory
spi1 at pins sdi=F1/sdo=C1/sck=D1
spi2 at pins sdi=F0/sdo=D11/sck=G6
spi3 at pins sdi=B10/sdo=C4/sck=B14
spi4 at pins sdi=F5/sdo=G0/sck=D10
uart1 at pins rx=D14/tx=D15, interrupts 112/113/114
uart4 at pins rx=F2/tx=F8, interrupts 170/171/172, console
sd0 at port spi3, pin cs=C3
sd0: type I, size 679936 kbytes, speed 12 Mbit/sec
sd0a: partition type b7, sector 2, size 204800 kbytes
sd0b: partition type b8, sector 409602, size 32768 kbytes
sd0c: partition type b7, sector 475138, size 102400 kbytes
bpf: lo0 attached
WARNING: preposterous clock chip time -- CHECK AND RESET THE DATE!

ps

# ps alx
  UID   PID  PPID CPU PRI NI   VSZ  RSS WCHAN  STAT TT       TIME COMMAND
    0     0     0   0 -18  0     0    0 schedu DLs  ??    0:00.00 (swapper)
    0     1     0   0  10  0   172    0 wait   IWs  ??    0:00.02 /sbin/init
    0     2     0   3 -18  0     0    0 -      RL   ??    0:00.76 (pagedaemon)
    0    22     1   0   2  0   144    0 select Ss   ??    0:00.03 syslogd
    0    33     1   0  18  0    20    0 pause  IWs  ??    0:00.00 update
    0    40     1   0  10  0   244    0 wait   Ss    4    0:00.16 -sh (sh)
    0    61    40   0  28  0   200    0 -      R+    4    0:00.00 (ps)

# ps aux
USER       PID %CPU %MEM   VSZ  RSS TT  STAT STARTED       TIME COMMAND
root         2  1.3  0.0     0    0 ??  RL    5:32PM    0:00.79 (pagedaemon)
root         1  0.0  0.0   172    0 ??  IWs   5:32PM    0:00.02 /sbin/init
root         0  0.0  0.0     0    0 ??  DLs   5:32PM    0:00.00 (swapper)
root        33  0.0  0.0    20    0 ??  SWs   5:32PM    0:00.01 update
root        40  0.1  0.0   244    0  4  Ss    5:32PM    0:00.17 -sh (sh)
root        62  0.0  0.0   200    0  4  R+    5:32PM    0:00.00 (ps)
root        22  0.0  0.0   144    0 ??  Ss    5:32PM    0:00.03 syslogd

uptime

# uptime
 1:28PM  up 0 user, load averages: 0.08, 0.02, 0.01

w

# w
 1:15AM  up 0 user, load averages: 0.08, 0.02, 0.01
USER    TTY FROM              LOGIN@  IDLE WHAT

last

# last
root      tty4                      Fri Nov 28 17:32   still logged in
reboot    ~                         Fri Nov 28 17:32

wtmp begins Fri Nov 28 17:32

##vmstat # vmstat procs memory page disks faults cpu r b w avm fre flt re pi po fr sr s0 ?1 ?2 ?3 in sy cs us sy id 0 0 0 12956 16 294 38 120 26 0 144 0 0 0 0 259 148 405 2 3 95

# vmstat 1
 procs   memory     page                    disks         faults      cpu
 r b w   avm   fre  flt  re  pi  po  fr  sr s0 ?1 ?2 ?3   in   sy  cs us sy id
 0 0 0 12956    16  861 127 363  78   0 460  0  0  0  0  649  347 1348  2 12 86
 0 0 0 12960    20   11   1   6   3   0  11  0  0  0  0  102   19  29  0  0 100
 0 0 0 12960    20    4   1   1   1   0   1  0  0  0  0  102   18   5  0  0 100
 0 0 0 12960    20    3   1   1   1   0   1  0  0  0  0  102   18   5  0  0 100
 0 0 0 12960    20    4   1   1   1   0   1  0  0  0  0  102   18   5  0  0 100
 0 0 0 12960    20    4   1   1   1   0   1  0  0  0  0  102   18   5  0  0 100
 0 0 0 12960    20    5   2   1   1   0   1  0  0  0  0  102   18   5  0  0 100

# vmstat -i
interrupt      total      rate
uart              137      137
clock               7        7
Total             144      144

# vmstat -s
      319 cpu context switches
      142 device interrupts
        0 software interrupts
      393 traps
      155 system calls
      295 total faults taken
        0 swap ins
        0 swap outs
        0 pages swapped in
        0 pages swapped out
      110 page ins
       20 page outs
      110 pages paged in
       20 pages paged out
       28 pages reactivated
        0 intransit blocking page faults
     6284 zero fill pages created
       59 zero fill page faults
      113 pages examined by the clock daemon
       75 revolutions of the clock hand
        8 VM object cache lookups
        8 VM object hits
        0 total VM faults taken
       31 copy-on-write faults
       93 pages freed by daemon
       19 pages freed by exiting processes
        4 pages free
       37 pages wired down
       32 pages active
       16 pages inactive
     4096 bytes per page
       16 target inactive pages
        5 target free pages
        4 minimum free pages
       45 total name lookups
          cache hits (42% pos + 2% neg) system 0% per-process
          deletions 0%, falsehits 0%, toolong 0%

# vmstat -m
Memory statistics by bucket size
    Size   In Use   Free   Requests  HighWater  Couldfree
      16       27    229        209    1280          0
      32       36     92         92     640          0
      64      147     45        302     320          0
     128      249      7        254     160          0
     256      256     16       2299      80          0
     512       10      6         13      40          0
    1024        8      4       2410      20          0
    4096        1      1          6       5          0
    8192        1      0          1       5          0

Memory usage type by bucket size
    Size  Type(s)
      16  vnodes, namecache, VM objhash, VM pvmap, VM pgdata, proc
      32  mbuf, devbuf, pgrp, session, VM pager, VM pgdata, proc, subproc,
          LFS segment
      64  routetbl, ifaddr, namecache, VM mapent, VM object, VM pgdata, file
     128  routetbl, zombie, ifaddr, cred, vnodes, VM pgdata, file desc, ttys
     256  devbuf, vnodes, VM map, FFS node
     512  mount, namecache, UFS mount, VM pgdata, proc
    1024  namei, ttys
    4096  UFS mount, exec
    8192  UFS mount

Memory statistics by type                        Type  Kern
      Type  InUse MemUse HighUse  Limit Requests Limit Limit Size(s)
       mbuf     1     1K      1K    96K        1    0     0  32
     devbuf     2     1K      1K    96K        2    0     0  32,256
   routetbl     3     1K      1K    96K        3    0     0  64,128
     zombie     0     0K      1K    96K        2    0     0  128
     ifaddr     2     1K      1K    96K        2    0     0  64,128
      namei     5     5K      6K    96K     2407    0     0  1024
       cred     2     1K      1K    96K        2    0     0  128
       pgrp     3     1K      1K    96K        5    0     0  32
    session     2     1K      1K    96K        2    0     0  32
      mount     1     1K      1K    96K        1    0     0  512
     vnodes   255    33K     35K    96K      393    0     0  16,128,256
  namecache    69     5K      5K    96K       69    0     0  16,64,512
  UFS mount     4    13K     13K    96K        4    0     0  512,4096,8192
     VM map     8     2K      3K    96K       20    0     0  256
  VM mapent    49     4K      4K    96K       94    0     0  64
  VM object    25     2K      2K    96K       58    0     0  64
 VM objhash     5     1K      1K    96K        5    0     0  16
   VM pvmap     0     0K      1K    96K       41    0     0  16
   VM pager    14     1K      1K    96K       20    0     0  32
  VM pgdata    23     2K      3K    96K       35    0     0  16,32,64,128,512
       file     4     1K      1K    96K       80    0     0  64
  file desc     4     1K      1K    96K        6    0     0  128
       proc     8     3K      3K    96K       10    0     0  16,32,512
    subproc     4     1K      1K    96K        6    0     0  32
LFS segment     0     0K      1K    96K       40    0     0  32
   FFS node   237    60K     60K    96K     2268    0     0  256
       ttys     5     4K      4K    96K        5    0     0  128,1024
       exec     0     0K      4K    96K        5    0     0  4096

Memory Totals:  In Use    Free    Requests
                  131K     26K        5586

iostat

# iostat
      tty          sd0           dk1           dk2           dk3          cpu
 tin tout sps tps msps  sps tps msps  sps tps msps  sps tps msps  us ni sy in id
   2  142   0   0  0.0    0   0  0.0    0   0  0.0    0   0  0.0   0  0  1  0 98

systat

# TERM=xterm
# systat
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average

                    /0   /10  /20  /30  /40  /50  /60  /70  /80  /90  /100
0        pagedaemon XXXXXXXXXXXXX
0                sh XXX

# systat -vmstat
    1 users    Load  0.09  0.03  0.01                  Sat Nov 29 22:37

Mem:KB  REAL        VIRTUAL                 PAGING   SWAPPING      Interrupts
      Tot Share    Tot  Share  Free         in  out   in  out      1051 total
Act    64    48   4408   4160    16 count   10    3                1001 uart
All   344   312  26156  14860       pages   10    3                  50 clock

Proc:r  p  d  s  w    Csw  Trp  Sys  Int  Sof  Flt        cow
                       33   23    6 1051        17        objlk
                                                          objht
   6.6% Sys   1.8% User   0.0% Nice  91.6% Idle           zfod
|    |    |    |    |    |    |    |    |    |    |       nzfod
===>                                                      %zfod
                                                          kern
Namei         Sys-cache     Proc-cache                172 wire
    Calls     hits    %     hits     %                132 act
                                                       32 inact
                                                       16 free
Discs                                                  10 daefr
seeks                                                     prcfr
xfers                                                     react
 blks                                                  12 scan
 msps                                                   8 hdrev

netstat

# netstat -in
Name  Mtu   Network     Address            Ipkts Ierrs    Opkts Oerrs  Coll
lo0   1536  <Link>                             0     0        0     0     0
lo0   1536  127         127.0.0.1              0     0        0     0     0

# netstat -rn
Routing tables

Internet:
Destination      Gateway            Flags     Refs     Use  Interface
127.0.0.1        127.0.0.1          UH          0        2  lo0

# netstat -m
0 mbufs in use:
0/4 mapped pages in use
4 Kbytes allocated to network (0% in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routines

# netstat -s
ip:
        0 total packets received
        0 bad header checksums
        0 with size smaller than minimum
        0 with data size < data length
        0 with header length < data size
        0 with data length < header length
        0 with bad options
        0 with incorrect version number
        0 fragments received
        0 fragments dropped (dup or out of space)
        0 fragments dropped after timeout
        0 packets reassembled ok
        0 packets for this host
        0 packets for unknown/unsupported protocol
        0 packets forwarded
        0 packets not forwardable
        0 redirects sent
        0 packets sent from this host
        0 packets sent with fabricated ip header
        0 output packets dropped due to no bufs, etc.
        0 output packets discarded due to no route
        0 output datagrams fragmented
        0 fragments created
        0 datagrams that can't be fragmented
icmp:
        0 calls to icmp_error
        0 errors not generated 'cuz old message was icmp
        0 messages with bad code fields
        0 messages < minimum length
        0 bad checksums
        0 messages with bad length
        0 message responses generated
igmp:
        0 messages received
        0 messages received with too few bytes
        0 messages received with bad checksum
        0 membership queries received
        0 membership queries received with invalid field(s)
        0 membership reports received
        0 membership reports received with invalid field(s)
        0 membership reports received for groups to which we belong
        0 membership reports sent
tcp:
        0 packets sent
                0 data packets (0 bytes)
                0 data packets (0 bytes) retransmitted
                0 ack-only packets (0 delayed)
                0 URG only packets
                0 window probe packets
                0 window update packets
                0 control packets
        0 packets received
                0 acks (for 0 bytes)
                0 duplicate acks
                0 acks for unsent data
                0 packets (0 bytes) received in-sequence
                0 completely duplicate packets (0 bytes)
                0 old duplicate packets
                0 packets with some dup. data (0 bytes duped)
                0 out-of-order packets (0 bytes)
                0 packets (0 bytes) of data after window
                0 window probes
                0 window update packets
                0 packets received after close
                0 discarded for bad checksums
                0 discarded for bad header offset fields
                0 discarded because packet too short
        0 connection requests
        0 connection accepts
        0 bad connection attempts
        0 connections established (including accepts)
        0 connections closed (including 0 drops)
        0 embryonic connections dropped
        0 segments updated rtt (of 0 attempts)
        0 retransmit timeouts
                0 connections dropped by rexmit timeout
        0 persist timeouts
        0 connections timed out in persist
        0 keepalive timeouts
                0 keepalive probes sent
                0 connections dropped by keepalive
        0 correct ACK header predictions
        0 correct data packet header predictions
        0 PCB cache misses
udp:
        0 datagrams received
        0 with incomplete header
        0 with bad data length field
        0 with bad checksum
        0 dropped due to no socket
        0 broadcast/multicast datagrams dropped due to no socket
        0 dropped due to full socket buffers
        0 delivered
        0 datagrams output

fstat

# fstat
USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
root     fstat         63   wd /         24704 drwxrwxr-x     512  r
root     fstat         63    0 /         12385 crw-------    tty4 rw
root     fstat         63    1 /         12385 crw-------    tty4 rw
root     fstat         63    2 /         12385 crw-------    tty4 rw
root     fstat         63    3 /         12357 crw-r-----     mem  r
root     fstat         63    4 /         12358 crw-r-----    kmem  r
root     fstat         63    5 /         12361 crw-r-----    drum  r
root     fstat         63    6 /         18759 -rw-------   40960  r
root     sh            40   wd /         24704 drwxrwxr-x     512  r
root     sh            40    0 /         12385 crw-------    tty4 rw
root     sh            40    1 /         12385 crw-------    tty4 rw
root     sh            40    2 /         12385 crw-------    tty4 rw
root     update        33   wd /             2 drwxr-xr-x     512  r
root     update        33    0 /         12359 crw-rw-rw-    null rw
root     update        33    1 /         12359 crw-rw-rw-    null rw
root     update        33    2 /         12359 crw-rw-rw-    null rw
root     syslogd       22   wd /             2 drwxr-xr-x     512  r
root     syslogd       22    0 /         12359 crw-rw-rw-    null rw
root     syslogd       22    1 /         12359 crw-rw-rw-    null rw
root     syslogd       22    2 /         12359 crw-rw-rw-    null rw
root     syslogd       22    3* unix dgram c0410f94
root     syslogd       22    4* internet dgram udp c0410a00
root     syslogd       22    5 /         12362 crw-------    klog  r
root     syslogd       22    7 -         -        none    -
root     syslogd       22    8 /          6374 -r--r--r--    1638  w
root     syslogd       22    9 /          6375 -r--r-----       0  w
root     syslogd       22   10 /          6372 -r--r--r--       0  w
root     syslogd       22   11 /          6373 -r--r--r--       0  w
root     syslogd       22   12 /         18757 -r--r--r--       0  w
root     syslogd       22   13 /          6370 -r--r--r--       0  w
root     pagedaemon     2   wd /             2 drwxr-xr-x     512  r
root     init           1   wd /             2 drwxr-xr-x     512  r
root     swapper        0   wd /             2 drwxr-xr-x     512  r

pstat

# pstat -T
 16/ 64 files
     52 vnodes
0M/32M swap space

# pstat -f
16/64 open files
   LOC   TYPE    FLG     CNT  MSG    DATA    OFFSET
c04126c0 inode       RW    6    0  c0410600  20351
c0416300 inode        R    1    0  c0410a80  0
c0416580 inode        R    1    0  c0410700  2684355220
c04162c0 inode        R    1    0  c0410000  0
c0412200 inode       RW    3    0  c0410c00  0
c040de40 inode       RW    3    0  c0410c00  0
c0412ac0 inode       WA    1    0  c0413e00  0
c0412b40 inode       WA    1    0  c0413e80  0
c0412bc0 inode       WA    1    0  c0413f00  0
c0412c40 inode       WA    1    0  c0413f80  0
c0412cc0 inode       WA    1    0  c0410580  0
c0412d80 inode       WA    1    0  c0405080  1638
c0412dc0 inode       WA    1    0  c0405780  0
c0412f00 inode        R    1    0  c0410400  957
c0402580 socket      RW    1    0  c0411700  0
c040d840 socket      RW    1    0  c040e100  0

# pstat -s
Device      1K-blocks     Used    Avail Capacity  Type
/dev/sd0b       32768      452    32316     1%    Interleaved

# pstat -t
5 uart lines
  LINE RAW CAN OUT  HWT LWT     COL STATE  SESS      PGID DISC
      0  0   0   0    0   0       0 -             0     0 term
      1  0   0   0    0   0       0 -             0     0 term
      2  0   0   0    0   0       0 -             0     0 term
   tty4  0   0   0 2048 256       0 OC     c0403dc0    67 term
      4  0   0   0    0   0       0 -             0     0 term
4 pty lines
  LINE RAW CAN OUT  HWT LWT     COL STATE  SESS      PGID DISC
      0  0   0   0    0   0       0 -             0     0 term
      1  0   0   0    0   0       0 -             0     0 term
      2  0   0   0    0   0       0 -             0     0 term
      3  0   0   0    0   0       0 -             0     0 term

# pstat -v
52 active vnodes
*** MOUNT ufs /dev/sd0a on / (local,rootfs)
ADDR     TYP VFLAG  USE HOLD FILEID IFLAG RDEV|SZ
c0410e00 chr     -    1    0  12361     -    drum
c0410a80 chr     -    1    0  12358     A    kmem
c0410700 chr     -    1    0  12357     -     mem
c0410000 dir     -    0    1 -559038737 UACMSE    1536
c0410100 dir     -    0    0 -559038737 UACMSE    1024
c0410780 dir     -    0    0 -559038737 UACMSE     512
c0405380 reg     T    1    4  18594    AM  146766
c0410480 reg     T    1    0    118    AM  164047
c0410b80 reg     T    1    0    207     -  136688
c0410080 reg     T    1    0   6194     -  169332
c0405800 reg     T    1    0   6241     -  103569
c0410200 reg     T    1    0   6181     -   66953
c0405600 reg     T    1    0    159     -  133978
c0413a00 reg     T    1    0   6198     A  198200
c0405480 reg     T    1    0   6187     -   83391
c0405200 reg     T    1    0    225     -   92593
c0405500 dir     -    2    0  24704     -     512
c0410980 reg     T    1    0    140     -  176032
c0410600 chr          2    0  12385   UCM    tty4
c0413d80 reg     T    1    0  12523     -  166413
c0410900 reg     T    1    0   6185     -   94515
c0405000 reg     T    1    0  18608     -   17305
c0405300 reg     T    1    0    111     -  181783
c0410d80 reg     T    1    0   6182     -   91136
c0405980 reg     T    1    0  18595     -  131795
c0405b00 blk     -    1    0  12422     -    sd0b
c0413b00 reg     T    1    0  18581     -  122508
c0413e00 reg     -    1    0   6370     -       0
c0413e80 reg     -    1    0  18757     -       0
c0413f00 reg     -    1    0   6373     -       0
c0413f80 reg     -    1    0   6372     -       0
c0410580 reg     -    1    0   6375     -       0
c0405080 reg     -    1    0   6374     -    1638
c0410400 chr     -    1    0  12362     -    klog
c0410f00 soc     -    1    0  12636     -       0
c0410280 reg     T    1    0  18603     -  111120
c0410800 reg     T    1    0    128     -  154326
c0410500 reg     T    1    0   6220     -   94661
c0410680 reg     T    1    0   6191     -   58310
c0410880 reg     T    1    0   6201     -  163382
c0410b00 reg     T    1    0   6223     -  174526
c0410c00 chr     -    2    0  12359     -    null
c0410d00 reg     T    1    0   6256     -  122881
c0410e80 reg     T    1    0   6254     -   76703
c0405180 reg     T    1    0   6218     -  207554
c0405c00 blk     -   53    1  12421     -    sd0a
c0405100 reg     T    1    0   6217     -   89524
c0405280 reg     T    1    0   6180     -   76551
c0405400 reg     T    1    0   6206     -   93534
c0405580 reg     T    1    0   6204     A  261866
c0405900 reg     T    1    0   6221     -  178559
c0405b80 dir     R    6    1      2     -     512

kgmon

# kgmon
kgmon: profiling not defined in kernel.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.