Skip to content

Commit

Permalink
Rewrite nems-stress to output averages, add frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
NEMS Linux committed Sep 3, 2019
1 parent b50e68e commit ca50fd0
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions nems-stress
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
#!/bin/bash

# This stress test will run for 5 minutes
if [[ ! -f /usr/bin/stress ]]; then
apt -y install stress
fi

cores=8
# How many minutes to run for
minutes=5

printf "Running test for $minutes minutes"

touch /var/log/nems-stress-temperature.log
touch /var/log/nems-stress-frequency.log

# Bring it to its knees...
cores=$(nproc --all)
stress --cpu $cores --timeout $((${minutes} * 60)) > /dev/null 2>&1 &
stress --cpu $cores --timeout $((${minutes} * 60)) > /dev/null 2>&1 &
stress --cpu $cores --timeout $((${minutes} * 60)) > /dev/null 2>&1 &

# main test runs for 20 minutes, constantly
stress --cpu $cores --timeout 1200 &
iterations=$((${minutes} * 6))
while [ $iterations -gt 0 ];
do
temperature=$(/usr/local/bin/nems-info temperature)
frequency=$(/usr/local/bin/nems-info frequency)
echo $temperature >> /var/log/nems-stress-temperature.log
echo $frequency >> /var/log/nems-stress-frequency.log
# Total sleep time of 10 seconds, with a period every 2 seconds
printf "." && sleep 2 && printf "." && sleep 2 && printf "." && sleep 2 && printf "." && sleep 2 && printf "." && sleep 2
iterations=$(($iterations-1))
done

# After 5 minutes, increase the load, for 15 minutes
sleep 300 && stress --cpu $cores --timeout 900 &
echo ""

# Get serious 10 minutes in and crank out 5 minutes of doom
sleep 300 && stress --cpu $cores --timeout 300 &
averagetemperature=$(awk '{ total += $2; count++ } END { print total/count }' /var/log/nems-stress-temperature.log)
echo "Average Temperature: $averagetemperature (Lower is better)"

# the stress test will stop after the timeouts are up.
averagefrequency=$(awk '{ total += $2; count++ } END { print total/count }' /var/log/nems-stress-frequency.log)
echo "Average Frequency: $averagefrequency (Higher is better)"

0 comments on commit ca50fd0

Please sign in to comment.