DDR 压测命令

DDR 压测命令

测试之前可以使用 free -m 查看内存使用情况。

» free
              total        used        free      shared  buff/cache   available
Mem:       16193884     1268028    13921020        6528     1004836    14587148
Swap:       4194304           0     4194304

» free -m
              total        used        free      shared  buff/cache   available
Mem:          15814        1231       13598           6         984       14252

根据 available 至设置 DDR 压测内存大小。

stressapptest

安装 stressapptest

stressapptest - stress test application for simulating high load situations

sudo apt install stressapptest

stressapptest help

» stressapptest -h
Stats: SAT revision 1.0.6_autoconf, 64 bit binary
Log: buildd @ lgw01-amd64-029 on Sun Mar 22 18:14:26 UTC 2020 from open source release
Usage: ./sat(32|64) [options]
 -M mbytes        megabytes of ram to test
 -H mbytes        minimum megabytes of hugepages to require
 -s seconds       number of seconds to run
 -m threads       number of memory copy threads to run
 -i threads       number of memory invert threads to run
 -C threads       number of memory CPU stress threads to run
 --findfiles      find locations to do disk IO automatically
 -d device        add a direct write disk thread with block device (or file) 'device'
 -f filename      add a disk thread with tempfile 'filename'
 -l logfile       log output to file 'logfile'
 --max_errors n   exit early after finding 'n' errors
 -v level         verbosity (0-20), default is 8
 -W               Use more CPU-stressful memory copy
 -A               run in degraded mode on incompatible systems
 -p pagesize      size in bytes of memory chunks
 --filesize size  size of disk IO tempfiles
 -n ipaddr        add a network thread connecting to system at 'ipaddr'
 --listen         run a thread to listen for and respond to network threads.
 --no_errors      run without checking for ECC or other errors
 --force_errors   inject false errors to test error handling
 --force_errors_like_crazy   inject a lot of false errors to test error handling
 -F               don't result check each transaction
 --stop_on_errors  Stop after finding the first error.
 --read-block-size     size of block for reading (-d)
 --write-block-size    size of block for writing (-d). If not defined, the size of block for writing will be defined as the size of block for reading
 --segment-size   size of segments to split disk into (-d)
 --cache-size     size of disk cache (-d)
 --blocks-per-segment  number of blocks to read/write per segment per iteration (-d)
 --read-threshold      maximum time (in us) a block read should take (-d)
 --write-threshold     maximum time (in us) a block write should take (-d)
 --random-threads      number of random threads for each disk write thread (-d)
 --destructive    write/wipe disk partition (-d)
 --monitor_mode   only do ECC error polling, no stress load.
 --cc_test        do the cache coherency testing
 --cc_inc_count   number of times to increment the cacheline's member
 --cc_line_count  number of cache line sized datastructures to allocate for the cache coherency threads to operate
 --paddr_base     allocate memory starting from this address
 --pause_delay    delay (in seconds) between power spikes
 --pause_duration duration (in seconds) of each pause
 --local_numa     choose memory regions associated with each CPU to be tested by that CPU
 --remote_numa    choose memory regions not associated with each CPU to be tested by that CPU
 --interleave_size bytes  size in bytes of each channel's data as interleaved between memory channels
 --channel_width bits     width in bits of each memory channel
 --memory_channel u1,u2   defines a comma-separated list of names
                          for dram packages in a memory channel.
                          Use multiple times to define multiple channels.
./stressapptest -M 14200 -s 36000 -m 8 -i 8 -C 8 -l /data/stressapptest.log

参数说明

  • -M 14200: 测试内存大小 14200M
  • -s 36000: 测试时常10h,压力测试建议不小于1h
  • -m threads:这个参数用于指定运行内存拷贝线程的数量。内存拷贝线程是执行内存数据复制操作的线程,增加线程数量可以增加内存操作的并发度,从而增加对系统的内存压力。
  • -i threads:这个参数用于指定运行内存反转(invert)线程的数量。内存反转线程通常是指执行内存数据位反转操作的线程,这也是一种压力测试,可以用于测试内存的写入和读取性能。
  • -C threads:表示启动的 CPU 压力测试线程的数量。增加这个数字可以增加 CPU 的负载,从而测试 CPU 在高压力下的性能表现。

若测试通过,则终端会打印:Status: PASS – please verify no corrected errors。

bw_mem

./bw_mem 128M rdwr