vmstat

virtual memory statistics

vmstat [-a] [-V] [-n] [delay-seconds [ count]]

information about processes, memory, paging, block IO, traps, and cpu activity.

The first report gives averages since boot.
Additional reports give information on a sampling period . The process and memory reports are instantaneous .

If no delay is specified, one report is printed with the average values since boot.

Examples taken from raspberry Pi Zero W up 3 hours, running RuuviCollextor(java), influxdb with grafana

-a
--active
  default
active/inactive memory
Procs r: waiting for run time.
b: uninterruptable sleep.
w: swapped out but otherwise runnable.
IO/s
block device
blocks in blocks out
Memory  
Kb
swpd: virtual memory used
free: idle
buff: buffers
System interrupts/s     context switches/s
including clock.
Swap
(kB/s)
swap in swap out CPU
  %
user system idle
vmstat
   procs                      memory      swap          io     system      cpu
 r  b  w   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id
 0  0  0 534524  90708  78300 1213912    0    1     0     0    1     0  1  1  0
vmstat 60 3
   procs                      memory      swap          io     system      cpu
 r  b  w   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id
 0  0  0 534696  67020  76172 1177164    0    1     0     0    1     0  1  1  0
 0  0  0 534648  63884  78728 1175752    2    0   533   607  385   558 11  2 87
 0  0  0 534636  70252  77504 1177920    3   36  1156   613  705   546 10  2 89
-w
--wide
wide output
 procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu-------- -----timestamp-----
 r  b         swpd         free         buff        cache   si   so    bi    bo   in   cs  us  sy  id  wa  st                 EDT
 0  0          256        35108        30900       136220    0    0    42    25  367  739  28   3  68   0   0 2019-04-25 18:50:45
 0  0          256        35108        30908       136248    0    0     0     8  297  610   4   4  91   0   0 2019-04-25 18:50:47
-t
--timestamp
show timestamp
-f
--forks
since boot
 1890 forks
-m
--slabs
slabinfo. See sudo slabtop for animated
Cache                  Num  Total Size Pages
UDPv6                   19    19   832   19
tw_sock_TCPv6           22    22   184   22
request_sock_TCPv6      17    17   240   17
TCPv6                   36    38  1664   19
cfq_io_cq                0     0    88   46
cfq_queue                0     0   176   23
mqueue_inode_cache       8     8   512    8
discard_cmd              0     0    56   73
discard_entry            0     0    80   51
nat_entry              170   170    24  170
f2fs_inode_cache        51    60   528   15
nfs_direct_cache         0     0   200   20
nfs_commit_data          9     9   448    9
nfs_read_data           42    42   576   14
nfs_inode_cache          0     0   640   12
fat_inode_cache         19    19   416   19
fat_cache              170   170    24  170
jbd2_journal_head       64   128    64   64
jbd2_revoke_table_s   3320  3328    16  256
ext4_inode_cache       945  1183   616   13
ext4_allocation_context 78    78   104   39
ext4_io_end             85    85    48   85
ext4_extent_status     728  1024    32  128
mbcache                104   204    40  102
dio                      0     0   336   12
pid_namespace            0     0   112   36
posix_timers_cache      24    24   168   24
rpc_inode_cache         22    22   352   11
UNIX                   204   208   608   13
xfrm_dst_cache           0     0   288   14
RAW                     12    12   672   12
UDP                     11    22   704   11
tw_sock_TCP             22    22   184   22
Cache                  Num Total  Size Pages
request_sock_TCP         17    17   240  17
TCP                      10    10  1536  10
cachefiles_object_jar     0     0   192  21
fscache_cookie_jar       85    85    48  85
dquot                    25    50   160  25
eventpoll_pwq           298   306    40 102
request_queue            33    33  1488  11
blkdev_requests           0     0   208  19
biovec-max               66    80  3072  10
biovec-128               10    10  1536  10
biovec-64                10    10   768  10
user_namespace            0     0   344  23
sock_inode_cache        287   300   384  10
skbuff_fclone_cache      10    50   384  10
configfs_dir_cache      134   146    56  73
file_lock_cache          34    34   120  34
file_lock_ctx           242   340    24 170
fsnotify_mark_connector 256   256    16 256
net_namespace            10    10  3104  10
shmem_inode_cache       813   819   376  21
taskstats                12    12   328  12
proc_inode_cache       3860  4011   376  21
sigqueue                 28    28   144  28
bdev_cache               32    32   480   8
kernfs_node_cache     12805 12810    96  42
mnt_cache               162   198   224  18
inode_cache            6833  7008   336  12
dentry                13098 13350   136  30
buffer_head           16715 17472    64  64
vm_area_struct         3791  3948    96  42
mm_struct                43    57   416  19
files_cache              50    63   192  21
signal_cache             94   108   672  12
Cache             Num  Total   Size Pages
sighand_cache      95    108   1312     12
task_struct       146    162   3552      9
cred_jar          241    288    128     32
anon_vma_chain   2604   3072     32    128
anon_vma         1563   1734     40    102
pid               308    320     64     64
trace_event_file  934    935     48     85
radix_tree_node  2860   2860    304     13
task_group       1402   1450    160     25
kmalloc-8192       24     24   8192      4
kmalloc-4096       31     40   4096      8
kmalloc-2048       60     72   2048      8
kmalloc-1024      245    256   1024      8
kmalloc-512       849    864    512      8
kmalloc-256       492    496    256     16
kmalloc-192       769    777    192     21
kmalloc-128       836    928    128     32
kmalloc-96       1150   1386     96     42
kmalloc-64      10744  11008     64     64
kmalloc-32      12014  12032     32    128
kmem_cache_node   128    128     32    128
kmem_cache        105    105    192     21
-s
--stats
event counters
       443836 K total memory
       197292 K used memory
       174168 K active memory
       138452 K inactive memory
       102920 K free memory
        32108 K buffer memory
       111516 K swap cache
      2097148 K total swap
          256 K used swap
      2096892 K free swap
       302933 non-nice user cpu ticks
            0 nice user cpu ticks
        31261 system cpu ticks
       735121 idle cpu ticks
         5491 IO-wait cpu ticks
            0 IRQ cpu ticks
         1477 softirq cpu ticks
            0 stolen cpu ticks
       430249 pages paged in
       273029 pages paged out
            0 pages swapped in
           43 pages swapped out

      3962642 interrupts
      7974307 CPU context switches

   1556222444 boot time
         2227 forks
-d
--disk |egrep 'rea|tot|mm'
disk

disk- -------------------reads------------------- -------------------writes------------------ ------IO------- -----timestamp-----
          total    merged     sectors          ms     total    merged     sectors          ms     cur     sec                 EDT
ram0          0         0           0           0         0         0           0           0       0       0 2019-04-25 19:06:45
…
ram15         0         0           0           0         0         0           0           0       0       0 2019-04-25 19:06:45
loop0         0         0           0           0         0         0           0           0       0       0 2019-04-25 19:06:45
…
loop7         0         0           0           0         0         0           0           0       0       0 2019-04-25 19:06:45
mmcblk0     10858      6939      860475       68040     18447     17107      562498      138020       0     108 2019-04-25 19:06:45

-D
--disk-sum
summarize disk
           25 disks SIC
            4 partitions 
        10896 total reads
         6939 merged reads
       861587 read sectors
        68310 milli reading
        18765 writes
        17429 merged writes
       572354 written sectors
       139480 milli writing
            0 inprogress IO
          109 milli spent IO
-p
--partition
partition specific
vmstat -p mmcblk0p1
mmcblk0p1     reads   read sectors  writes    requested writes
  boot          107       4657          2          2

 vmstat -p mmcblk0p2 5 2
mmcblk0p2     reads   read sectors  writes    requested writes
    root       10483     844586      18184     520320
               10483     844586      18190     520416

vmstat -p mmcblk0p4 5 2
mmcblk0p4     reads   read sectors  writes    requested writes
    swap          43       4400         11        344
                  43       4400         11        344

vmstat -p mmcblk0p3 10 2
mmcblk0p3     reads   read sectors  writes    requested writes
    log          228       6032       1005      65712
                 228       6032       1006      65744


 
-n
--one-header
do not redisplay header
-S
--unit [k|K|m|M]
define display unit (default is KiB)
-h
--help
display this help and exit
-V
--version
output version information and exit
vmstat from procps-ng 3.3.12

Does not count itself as a running process.

Blocks are 1k, except for CD-ROM blocks which are 2k.

FILES

/proc/meminfo, /proc/stat, /proc/*/stat, 

SEE

ps, top, free sar, sadc(8), sa1(8), sa2(8), iostat, mpstat(8)


slabtop

display kernel slab cache information in real time

sudo slabtop [options]

displays detailed kernel slab cache information in real time.

a listing of the top caches sorted by one of the listed sort criteria.

a statistics header filled with slab layer information.

-d
--delay=secs
Default, 3 seconds.
-s
--sort=k
Sort by
       o  number of objects          OBJS   -default
       a  number of active objects   ACTIVE
       u  cache utilization          USE
       s  object size                OBJ SIZE
       b  objects per slab           OBJ/SLAB
       l  number of slabs            SLABS
       v  number of active slabs    
       p  pages per slab             
       c  cache size                 CACHE SIZE
       n  name                       NAME
-o
--once
Display once and exit.
-V
--version
-h
--help
Accepts sort keys while active and SPACE Refresh the screen.
Q|q Quit

Reduce terminal font size and strech window height to see maximun rows.

fopen /proc/slabinfo: Permission denied
/home/dgerman > sudo slabtop

 Active / Total Objects (% used)    : 105450 / 109770 (96.1%)
 Active / Total Slabs (% used)      : 3184 / 3184 (100.0%)
 Active / Total Caches (% used)     : 76 / 88 (86.4%)
 Active / Total Size (% used)       : 14845.79K / 15487.26K (95.9%)
 Minimum / Average / Maximum Object : 0.02K / 0.14K / 8.00K

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME                   
 18176  16672   0%    0.06K    284       64      1136K buffer_head
 14490  14440   0%    0.13K    483       30      1932K dentry
 12810  12805   0%    0.09K    305       42      1220K kernfs_node_cache
 12032  12014   0%    0.03K     94      128       376K kmalloc-32
 11008  10733   0%    0.06K    172       64       688K kmalloc-64
  7008   6878   0%    0.33K    584       12      2336K inode_cache
  4179   4146   0%    0.37K    199       21      1592K proc_inode_cache
  3990   3812   0%    0.09K     95       42       380K vm_area_struct
  3328   3318   0%    0.02K     13      256        52K jbd2_revoke_table_s
  3072   2640   0%    0.03K     24      128        96K anon_vma_chain
  2964   2964 100%    0.30K    228       13       912K radix_tree_node
  1734   1590   0%    0.04K     17      102        68K anon_vma
  1450   1409   0%    0.16K     58       25       232K task_group
  1386   1159   0%    0.09K     33       42       132K kmalloc-96
  1183   1020   0%    0.60K     91       13       728K ext4_inode_cache
  1024    612   0%    0.03K      8      128        32K ext4_extent_status
   935    934   0%    0.05K     11       85        44K trace_event_file
   928    836   0%    0.12K     29       32       116K kmalloc-128
   864    849   0%    0.50K    108        8       432K kmalloc-512
   819    815   0%    0.37K     39       21       312K shmem_inode_cache
   777    769   0%    0.19K     37       21       148K kmalloc-192
   496    492   0%    0.25K     31       16       124K kmalloc-256
   340    242   0%    0.02K      2      170         8K file_lock_ctx
   320    308   0%    0.06K      5       64        20K pid
   306    298   0%    0.04K      3      102        12K eventpoll_pwq
   300    287   0%    0.38K     30       10       120K sock_inode_cache
   288    239   0%    0.12K      9       32        36K cred_jar
   256    245   0%    1.00K     32        8       256K kmalloc-1024
   256    256 100%    0.02K      1      256         4K fsnotify_mark_connector
   208    204   0%    0.59K     16       13       128K UNIX
   204    134   0%    0.04K      2      102         8K mbcache
   198    162   0%    0.22K     11       18        44K mnt_cache
   170    170 100%    0.02K      1      170         4K fat_cache
   170    170 100%    0.02K      1      170         4K nat_entry
   162    146   0%    3.47K     18        9       576K task_struct
   146    134   0%    0.05K      2       73         8K configfs_dir_cache
   128    128 100%    0.03K      1      128         4K kmem_cache_node
   128     64   0%    0.06K      2       64         8K jbd2_journal_head
   108     92   0%    1.28K      9       12       144K sighand_cache
   108     90   0%    0.66K      9       12        72K signal_cache
   105    105 100%    0.19K      5       21        20K kmem_cache
    85     85 100%    0.05K      1       85         4K fscache_cookie_jar
    85     85 100%    0.05K      1       85         4K ext4_io_end
    80     66   0%    3.00K      8       10       256K biovec-max
    78     78 100%    0.10K      2       39         8K ext4_allocation_context
    72     60   0%    2.00K      9        8       144K kmalloc-2048
    63     47   0%    0.19K      3       21        12K files_cache
    60     51   0%    0.52K      4       15        32K f2fs_inode_cache
    57     47   0%    0.41K      3       19        24K mm_struct
    50     10   0%    0.38K      5       10        20K skbuff_fclone_cache
    50     25   0%    0.16K      2       25         8K dquot
    42     42 100%    0.56K      3       14        24K nfs_read_data
    40     32   0%    4.00K      5        8       160K kmalloc-4096
    38     36   0%    1.62K      2       19        64K TCPv6
    34     34 100%    0.12K      1       34         4K file_lock_cache
    33     33 100%    1.45K      3       11        48K request_queue
    32     32 100%    0.47K      4        8        16K bdev_cache
    28     28 100%    0.14K      1       28         4K sigqueue
    24     24 100%    8.00K      6        4       192K kmalloc-8192
    24     24 100%    0.16K      1       24         4K posix_timers_cache
    22     22 100%    0.18K      1       22         4K tw_sock_TCP
    22     11   0%    0.69K      2       11        16K UDP
    22     22 100%    0.34K      2       11         8K rpc_inode_cache
    22     22 100%    0.18K      1       22         4K tw_sock_TCPv6
    19     19 100%    0.41K      1       19         8K fat_inode_cache
    19     19 100%    0.81K      1       19        16K UDPv6
    17     17 100%    0.23K      1       17         4K request_sock_TCP
    17     17 100%    0.23K      1       17         4K request_sock_TCPv6
    12     12 100%    0.32K      1       12         4K taskstats
    12     12 100%    0.66K      1       12         8K RAW
    10     10 100%    3.03K      1       10        32K net_namespace
    10     10 100%    0.75K      1       10         8K biovec-64
    10     10 100%    1.50K      1       10        16K biovec-128
    10     10 100%    1.50K      1       10        16K TCP
     9      9 100%    0.44K      1        9         4K nfs_commit_data
     8      8 100%    0.50K      1        8         4K mqueue_inode_cache
     0      0   0%    0.34K      0       23         0K user_namespace
     0      0   0%    0.20K      0       19         0K blkdev_requests
     0      0   0%    0.19K      0       21         0K cachefiles_object_jar
     0      0   0%    0.28K      0       14         0K xfrm_dst_cache
     0      0   0%    0.11K      0       36         0K pid_namespace
     0      0   0%    0.33K      0       12         0K dio
     0      0   0%    0.62K      0       12         0K nfs_inode_cache
     0      0   0%    0.20K      0       20         0K nfs_direct_cache
     0      0   0%    0.08K      0       51         0K discard_entry
     0      0   0%    0.05K      0       73         0K discard_cmd
     0      0   0%    0.17K      0       23         0K cfq_queue

FILES

/proc/slabinfo

See

free(1), ps(1), top(1), vmstat(8)

The slabtop statistic header is tracking how many bytes of slabs are being used and is not a measure of physical memory. The 'Slab' field in the /proc/meminfo file is tracking information about used slab physical memory.