龙芯板卡内存压力测试方法

it2022-05-05  183

龙芯板卡内存压力测试方法

方法一

1、 测试工具

http://ftp.loongnix.org/embedd/others/stressapptest

2、将 stressapptest 放到龙芯板卡系统下 ,添加执行权限

#chmod +x stressapptest

3、系统下执行 free 命令查看可使用的内存大小

#free -m

4、内存压力测试需要多开几个进程,假如可用内存有100M,可以开启9个进程跑压力测试,执行9次下面命令

#./stressapptest -M 10 -s 604800 & #./stressapptest -M 10 -s 604800 & #./stressapptest -M 10 -s 604800 & #./stressapptest -M 10 -s 604800 & #./stressapptest -M 10 -s 604800 & #./stressapptest -M 10 -s 604800 & #./stressapptest -M 10 -s 604800 & #./stressapptest -M 10 -s 604800 & #./stressapptest -M 10 -s 604800 &

-M 指定内存大小,单位兆;-s 制定时间,单位是秒(测试时间:7*24 小时)

5、将测试信息log保存,测试完查询log中如出现Err字样,说明内存不稳, 需要根据现象做相应调试;如没有出现Err,则代表内存稳定。

方法二 1、 测试准备

1、下载工具 http://ftp.loongnix.org/embedd/others/stressapptest 2、创建执行脚本stressapp.sh 3、修改权限

#!/bin/sh error=0 #[[ "$3" =~ ^[0-9]+$ ]] && size=$3 || error=3 #[[ "$2" =~ ^[0-9]+$ ]] && runtime=$2 || error=2 #[[ "$1" =~ ^[0-9]+$ ]] && cont=$1 || error=1 [[ $3 =~ ^[0-9] ]] && size=$3 || error=3 [[ $2 =~ ^[0-9] ]] && runtime=$2 || error=2 [[ $1 =~ ^[0-9] ]] && cont=$1 || error=1 if [[ "$error" -ne "0" ]];then echo ">> parameter $error error!" echo ">> ./stressapp.sh cont time size" exit fi echo ">> execute $cont ./stressapptest -s $runtime -M $size" for i in $(seq 1 $cont) do echo "process $i" ./stressapptest -s $runtime -M $size & done free -m

2、 执行脚本

./stressapp.sh cont time size cont:代表开的进程数(建议1040) time:测试时间(有条件的话尽量3天以上),单位s size:单个进程内存大小,单位M 例如: a、free 产看到的空闲内存6200M b、./stressapp.sh 30 999999999 200 > 1.log

方法三 方法三可以定时检查测试结果,如测试中出现错误就会停止测试 1、 测试准备

1、下载工具 http://ftp.loongnix.org/embedd/others/stressapptest 2、创建执行脚本stressapp.sh 脚本默认是测试3天,如想修改测试时间,可以修改脚本里totaltime值 3、修改权限

#!/bin/sh error=0 #[[ "$2" =~ ^[0-9]+$ ]] && size=$2 || error=2 #[[ "$1" =~ ^[0-9]+$ ]] && cont=$1 || error=1 [[ $2 =~ ^[0-9] ]] && size=$2 || error=2 [[ $1 =~ ^[0-9] ]] && cont=$1 || error=1 if [[ "$error" -ne "0" ]];then echo ">> parameter $error error!" echo ">> ./stressapp.sh cont size" exit fi #3day totaltime=259200 adaytime=86400 echo echo "free -m" echo "----------------------------------------------------------------" free -m echo "----------------------------------------------------------------" echo sleep 1 echo "--------------------Start memory stress test--------------------" for i in $(seq 1 $cont) do ./stressapptest -s $totaltime -M $size >> ./ddrtest & echo ">> execute $i ./stressapptest -s $totaltime -M $size" done sleep 15 echo echo "free -m" echo "----------------------------------------------------------------" free -m echo "----------------------------------------------------------------" echo onedaytime=$(expr $(date -d "$(date +%F) $(date +%T)" +%s) + $adaytime) twodaytime=$(expr $onedaytime + $adaytime) endtime=$(expr $(date -d "$(date +%F) $(date +%T)" +%s) + $totaltime) time1=$(date -d @$endtime) echo "End time is $time1 ddrtest!" > ./endtime echo "End time is $time1 ddrtest!" echo "----------------------------------------------------------------" echo testrows=0 display_day2=1 display_day3=1 echo "Start ddr testing the one day" while : do sleep 300 nowtime=$(date -d "$(date +%F) $(date +%T)" +%s) tmp=$(wc -l ./ddrtest) allrows=${tmp% *} rows=$(expr $allrows - $testrows) testrows=$(expr $testrows + $rows) tail -n$rows ./ddrtest > ./log grep "Err" -nr ./log >> ./error.log if [ $? -eq 0 ]; then echo "ddr test is error!" echo "ddr test is error!" > ./result.log killall -9 stressapptest rm ./log -rf exit fi echo "ddrtest test rows:$testrows" if [ $nowtime -gt $endtime ]; then echo "ddr test is success!" echo "ddr test is success!" > ./result.log rm ./log -rf exit fi if [ $nowtime -gt $onedaytime ]; then #day2 if [ $display_day2 -eq 1 ]; then echo "Start ddr testing the two day" display_day2=0; fi if [ $nowtime -gt $twodaytime ]; then #day3 if [ $display_day3 -eq 1 ]; then echo "Start ddr testing the three day" display_day3=0; fi fi fi done

2、 执行脚本

./stressapp.sh cont size cont:代表开的进程数(建议1040) size:单个进程内存大小,单位M

备注: 1、如果想提前结束执行:killall stressapptest 2、判断压力测试是否通过,查看1.log文件里是否有Err字符,如果没有代表测试通过


最新回复(0)