Linux性能测试工具之memory(二)

Memory

2.1 vmstat

vmstat统计虚拟内存使用情况

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  ### 单位k(1000),K(1024),m(1000000),M(1048576) bytes
 -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).

vmstat查看虚拟内存使用信息

vmstat-1

vmstat查看disk、查看slab使用信息

vmstat

2.2 PSI

Linux pressure stall information (PSI), added in Linux 4.20, includes statistics for memory saturation. These not only show if there is memory pressure, but how it is changing in the last five minutes.

# cat /proc/pressure/memory
some avg10=2.84 avg60=1.23 avg300=0.32 total=1468344
full avg10=1.85 avg60=0.66 avg300=0.16 total=702578

上表数据表明,300秒平均内,内存压力是0.32,近10秒内内存压力平均是2.84,表明压力在增加。这些平均值代表进程阻塞在内存memory上的时间百分比。

some一行表示某些进程(线程)受影响。full一行表示所有的可运行状态进程受影响。

2.3 swapon

swapon, swapoff - enable/disable devices and files for paging and swapping

swapon [options] [specialfile...]
swapoff [-va] [specialfile...]
root@ubuntu:test# swapon
NAME      TYPE SIZE USED PRIO
/swapfile file   2G   0B   -2
2.4 slabtop

The Linux slabtop(1) command prints kernel slab cache usage from the slab allocator.

Usage:
 slabtop [options]

Options:
 -d, --delay <secs>  delay updates
 -o, --once          only display once, then exit
 -s, --sort <char>   specify sort criteria by character (see below)

 -h, --help     display this help and exit
 -V, --version  output version information and exit

The following are valid sort criteria:
 a: sort by number of active objects
 b: sort by objects per slab
 c: sort by cache size
 l: sort by number of slabs
 v: sort by number of active slabs
 n: sort by name
 o: sort by number of objects (the default)
 p: sort by pages per slab
 s: sort by object size
 u: sort by cache utilization

For more details see slabtop
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值