CPU压力测试

CPU压力测试

   小白     2024年4月4日 17:46     229    

需要安装cpuburn-in工具

#!/bin/bash


cd /1/cpuburn-in

#mkdir yes

#pwd

declare -i m

m=$1+1

echo $m

for i in `seq "$1"`

do

    ./cpuburn-in 500000 1>/dev/null &

done

#kill cpuburn-in process

echo "please input y quit!"

read J

echo $J

if [ $J == y ]

then

    for k in `seq "$m"`

    do

        num2=`ps -ef | grep "./cpuburn-in" |sed -n ''$k'p' | awk -F " " '{print $4}'`

        echo "this is $num2"

        if [ $num2 == 0 ]

        then

            continue        

        fi


        num[k]=`ps -ef | grep "./cpuburn-in" | sed -n ''$k'p' | awk -F " " '{print $2}'`

        echo "that is $num"

    done


    for n in `seq "$1"`

    do

        #echo "${num[n]}"

        kill -9 ${num[n]}

    done

fi


文章评论

0

其他文章