diff options
author | Jeff Lane <jeffrey.lane@canonical.com> | 2016-08-18 15:44:41 -0400 |
---|---|---|
committer | Jeff Lane <jeffrey.lane@canonical.com> | 2016-08-18 15:44:41 -0400 |
commit | ab8e82749b0ee4b651c1f6c7406d1d0dec10a876 (patch) | |
tree | 3c8c04a5cbb25d4095ecfb281368c3f4ab5b4a13 /bin | |
parent | 7e2e34f86f43c4f6e0a65954fd6326f8511f1ddb (diff) |
scripts/cpu_offlining: Quieted output and improved messaging for failures. jobs/cpu.txt.in - updated estimated duration based on a .5 second sleep per core and up to 256 cores
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cpu_offlining | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/bin/cpu_offlining b/bin/cpu_offlining index 0e88af1..7f1095a 100755 --- a/bin/cpu_offlining +++ b/bin/cpu_offlining @@ -1,22 +1,24 @@ #!/bin/bash -echo "Beginning CPU Offlining Test" 1>&2 - result=0 cpu_count=0 +offline_fails="Offline Failed:" +online_fails="Online Failed:" +exitcode=0 # Turn CPU cores off for cpu_num in `ls /sys/devices/system/cpu | grep -o cpu[0-9]*`; do if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then if [ "$cpu_num" != "cpu0" ]; then ((cpu_count++)) - echo "Offlining $cpu_num" 1>&2 echo 0 > /sys/devices/system/cpu/$cpu_num/online - - grep -w -i -q $cpu_num /proc/interrupts - if [ $? -eq 0 ]; then + sleep 0.5 + output=`grep -w -i $cpu_num /proc/interrupts` + result=$? + if [ $result -eq 0 ]; then echo "ERROR: Failed to offline $cpu_num" 1>&2 - result=1 + offline_fails="$offline_fails $cpu_num" + exitcode=1 fi fi fi @@ -26,21 +28,25 @@ done for cpu_num in `ls /sys/devices/system/cpu | grep -o cpu[0-9]*`; do if [ -f /sys/devices/system/cpu/$cpu_num/online ]; then if [ "$cpu_num" != "cpu0" ]; then - echo "Onlining $cpu_num" 1>&2 echo 1 > /sys/devices/system/cpu/$cpu_num/online - grep -w -i -q $cpu_num /proc/interrupts - if [ $? -eq 1 ]; then + sleep 0.5 + output=`grep -w -i $cpu_num /proc/interrupts` + result=$? + if [ $result -eq 1 ]; then echo "ERROR: Failed to online $cpu_num" 1>&2 - result=1 + online_fails="$online_fails $cpu_num" + exitcode=1 fi fi fi done -if [ $result -eq 0 ]; then +if [ $exitcode -eq 0 ]; then echo "Successfully turned $cpu_count cores off and back on" else echo "Error with offlining one or more cores. CPU offline may not work if this is an ARM system." 1>&2 + echo $offline_fails 1>&2 + echo $online_fails 1>&2 fi -exit $result +exit $exitcode |