about summary refs log tree commit diff
path: root/Completion/BSD/Command/_systat
blob: 03df0763183e6967b843c01f6969d30a7d6e5a22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#compdef systat

local -a screens opts
local pre
case $OSTYPE in
  freebsd*)
    pre=-
    screens=(
      'pigs:processes consuming the most CPU time'
      'sctp:SCTP statistics'
      icmp{6,}':ICMP statistics'
      ip{6,}':IP and UDP statistics'
      'tcp:TCP statistics'
      'iostat:processor and disk statistics'
      'swap:swap space statistics'
      'vmstat:virtual memory statistics'
      'netstat:network connection statistics'
      'ifstat:network traffic statistics'
      'zarc:display arc cache usage'
    )
  ;;
  openbsd*)
    screens=(
      'buckets:kernel malloc(9) bucket statistics'
      'cpu:per CPU, usage statistics'
      'ifstat:interface statistics'
      'iostat:disk throughput statistics'
      'malloc:malloc(9) type statistics'
      'mbufs:mbuf usage statistics'
      'netstat:network connection statistics'
      'nfsclient:NFS client statistics'
      'nfsserver:NFS server statistics'
      'pf:pf(4) filter statistics'
      'pigs:processes consuming the most CPU time'
      'pool:pool(9) statistics'
      'queues:pf(4) queue statistics'
      'rules:pf(4) rule statistics'
      'sensors:display hardware sensors values'
      'states:pf(4) states statistics'
      'swap:swap space usage'
      'vmstat:virtual memory statistics'
    )
    opts=(
      '-a[display all lines]'
      '-B[raw, non-interactive mode (two screen updates)]'
      '-b[raw, non-interactive mode (one screen update)]'
      '-d[exit after `count'\'' updates]:count'
      '-h[human readable output]'
      '-i[interactive mode]'
      '-N[resolve network addresses to names]'
      '-n[do not resolve network addresses to names]'
      '-s[screen refresh interval]:refresh interval (seconds)'
      '-w[maximum width of output in raw mode]:width'
    )
  ;;
  netbsd*)
    screens=(
      'all:cycle through all displays'
      'bufcache:filesystem buffer statistics'
      'df:disk usage statistics'
      'inet.icmp:ICMP statistics'
      'inet.ip:IPv4 and UDP statistics'
      'inet.tcp:TCP statistics'
      'inet.tcpsyn:TCP ``syncache'\'\'' statistics'
      'inet6.ip6:IPv6 statistics'
      'iostat:disk throughput statistics'
      'mbufs:mbuf usage statistics'
      'netstat:network connection statistics'
      'pigs:processes consuming the most CPU time'
      'ps:``ps -aux'\'\'' in a loop'
      'swap:swap space usage'
      'syscall:per system call statistics'
      'vmstat:virtual memory statistics'
    )
    opts=(
      '-M[alternative source to extract values from]:core:_files'
      '-N[alternative source to extract the name list from]:system:_files'
      '(-t -w)-b[show the chosen display once and exit]'
      "-n[don't resolve IP addresses]"
      '(-b)-w[refresh interval]:refresh interval'
      "(-b)-t[specify amount of refreshes for each screen in 'all' display mode]:turns"
    )
esac

if (( $#screens )); then
  _arguments -M 'r:|.=* r:|=*' : $opts \
    '1:systat(1) display:(( ${pre}$^screens ))' \
    '2:refresh interval'
  return
fi

_default