Skip to content
Permalink
Browse files

Rewrite nems-stress to output averages, add frequency

  • Loading branch information...
NEMS Linux
NEMS Linux committed Sep 3, 2019
1 parent b50e68e commit ca50fd0c32880c75183d2403a23452479b5cead5
Showing with 31 additions and 8 deletions.
  1. +31 −8 nems-stress
@@ -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.
You can’t perform that action at this time.