Mit vmstat (virtual memory statistics) können leicht folgende Werte fast in Echtzeit angzeigt werden:
Anzeige der Prozesse, Speicher, Paging, Block IO und CPU Aktivität …
Hier die Anleitung, die mit vmstat -h angezeigt werden kann:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
vmstat -h Usage: vmstat [options] [delay [count]] Options: -a, --active active/inactive memory -f, --forks number of forks since boot -m, --slabs slabinfo -n, --one-header do not redisplay header -s, --stats event counter statistics -d, --disk disk statistics -D, --disk-sum summarize disk statistics -p, --partition <dev> partition specific statistics -S, --unit <char> define display unit -w, --wide wide output -t, --timestamp show timestamp -h, --help display this help and exit -V, --version output version information and exit For more details see vmstat(8). |
Weitere Infos gibt man vmstat oder die Seite
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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
NAME vmstat - Report virtual memory statistics SYNOPSIS vmstat [options] [delay [count]] DESCRIPTION vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity. The first report produced gives averages since the last reboot. Additional reports give infor‐ mation on a sampling period of length delay. The process and memory reports are instantaneous in either case. OPTIONS delay The delay between updates in seconds. If no delay is specified, only one report is printed with the average values since boot. count Number of updates. In absence of count, when delay is defined, default is infinite. -a, --active Display active and inactive memory, given a 2.5.41 kernel or better. -f, --forks The -f switch displays the number of forks since boot. This includes the fork, vfork, and clone system calls, and is equivalent to the total number of tasks created. Each process is represented by one or more tasks, depending on thread usage. This display does not repeat. -m, --slabs Displays slabinfo. -n, --one-header Display the header only once rather than periodically. -s, --stats Displays a table of various event counters and memory statistics. This display does not repeat. -d, --disk Report disk statistics (2.5.70 or above required). -D, --disk-sum Report some summary statistics about disk activity. -p, --partition device Detailed statistics about partition (2.5.70 or above required). -S, --unit character Switches outputs between 1000 (k), 1024 (K), 1000000 (m), or 1048576 (M) bytes. Note this does not change the swap (si/so) or block (bi/bo) fields. -t, --timestamp Append timestamp to each line -w, --wide Wide output mode (useful for systems with higher amount of memory, where the default output mode suffers from unwanted column breakage). The output is wider than 80 charac‐ ters per line. -V, --version Display version information and exit. -h, --help Display help and exit. FIELD DESCRIPTION FOR VM MODE Procs r: The number of runnable processes (running or waiting for run time). b: The number of processes in uninterruptible sleep. Memory swpd: the amount of virtual memory used. free: the amount of idle memory. buff: the amount of memory used as buffers. cache: the amount of memory used as cache. inact: the amount of inactive memory. (-a option) active: the amount of active memory. (-a option) Swap si: Amount of memory swapped in from disk (/s). so: Amount of memory swapped to disk (/s). IO bi: Blocks received from a block device (blocks/s). bo: Blocks sent to a block device (blocks/s). System in: The number of interrupts per second, including the clock. cs: The number of context switches per second. CPU These are percentages of total CPU time. us: Time spent running non-kernel code. (user time, including nice time) sy: Time spent running kernel code. (system time) id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time. wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle. st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown. FIELD DESCRIPTION FOR DISK MODE Reads total: Total reads completed successfully merged: grouped reads (resulting in one I/O) sectors: Sectors read successfully ms: milliseconds spent reading Writes total: Total writes completed successfully merged: grouped writes (resulting in one I/O) sectors: Sectors written successfully ms: milliseconds spent writing IO cur: I/O in progress s: seconds spent for I/O FIELD DESCRIPTION FOR DISK PARTITION MODE reads: Total number of reads issued to this partition read sectors: Total read sectors for partition writes : Total number of writes issued to this partition requested writes: Total number of write requests made for partition FIELD DESCRIPTION FOR SLAB MODE cache: Cache name num: Number of currently active objects total: Total number of available objects size: Size of each object pages: Number of pages with at least one active object NOTES vmstat does not require special permissions. These reports are intended to help identify system bottlenecks. Linux vmstat does not count itself as a running process. All linux blocks are currently 1024 bytes. Old kernels may report blocks as 512 bytes, 2048 bytes, or 4096 bytes. Since procps 3.1.9, vmstat lets you choose units (k, K, m, M). Default is K (1024 bytes) in the default mode. vmstat uses slabinfo 1.1 FILES /proc/meminfo /proc/stat /proc/*/stat ... |
Fangen wir mit einer Messung alle 2 Sekunden an, und beenden wir das Programm automatisch nach 8 Messungen, Aufruf:
vmstat 2 8
Hier das Ergebnis auf einen Rasberry Pi Zero W:
1 2 3 4 5 6 7 8 9 10 |
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 1536 33268 134640 236680 0 0 3 1 29 41 0 0 99 0 0 0 0 1536 33268 134640 236680 0 0 0 0 70 74 0 0 100 0 0 0 0 1536 33268 134640 236680 0 0 0 0 45 52 0 0 100 0 0 0 0 1536 33268 134644 236680 0 0 0 2 36 48 0 1 99 1 0 0 0 1536 33268 134644 236680 0 0 0 0 33 40 0 0 100 0 0 0 0 1536 33268 134644 236680 0 0 0 16 129 126 3 1 96 0 0 0 0 1536 33268 134644 236680 0 0 0 0 51 64 0 1 99 0 0 0 0 1536 33268 134644 236680 0 0 0 0 99 86 1 1 99 0 0 |
Und mit etwas Last beim Linken von Gnuradio:
1 2 3 4 5 6 7 8 9 10 |
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 37120 31156 5764 69312 0 0 14 18 248 119 13 1 86 0 0 1 0 37120 331608 5772 69772 0 0 174 106 4308 159 88 11 0 0 0 1 0 37120 326400 6048 74216 2 0 2554 0 4388 746 69 15 0 16 0 1 0 37120 320944 6056 74216 0 0 0 60 4225 68 100 0 0 0 0 1 0 37120 316108 6056 74216 0 0 0 0 4222 47 98 3 0 0 0 1 0 37120 311272 6056 74216 0 0 0 0 4208 37 99 2 0 0 0 2 0 37120 306932 6056 74224 0 0 0 4 4083 61 99 2 0 0 0 1 0 37120 305272 7600 79836 2 0 3578 0 4220 847 59 23 0 19 0 |
vmstat -D
1 2 3 4 5 6 7 8 9 10 11 12 |
25 disks 2 partitions 25537 total reads 9365 merged reads 496408 read sectors 33220 milli reading 6656 writes 5774 merged writes 105819 written sectors 287330 milli writing 0 inprogress IO 92 milli spent IO |
vmstat -s
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 |
443900 K total memory 39344 K used memory 209896 K active memory 71976 K inactive memory 32028 K free memory 134652 K buffer memory 237876 K swap cache 102396 K total swap 1536 K used swap 100860 K free swap 21169 non-nice user cpu ticks 920 nice user cpu ticks 23434 system cpu ticks 9814375 idle cpu ticks 3614 IO-wait cpu ticks 0 IRQ cpu ticks 2530 softirq cpu ticks 0 stolen cpu ticks 248268 pages paged in 52909 pages paged out 26 pages swapped in 340 pages swapped out 2917180 interrupts 4098152 CPU context switches 1524489822 boot time 8072 forks |