summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-07-01 10:47:28 +0530
committerViresh Kumar <viresh.kumar@linaro.org>2014-07-02 11:18:01 +0530
commitc41fd0d6a2f419619f3fc5442602bc82cb1eb585 (patch)
tree4d626568209efe94f1ed19f467b1d848ab84d90e
parent8fd32872b2799e0211f137d5666ded7acae4a378 (diff)
is-cpu-isolated: Isolate more than one CPU
Until now, we only handle isolation for One cpu. But for better test coverage, we actually need support for more CPUs. This patch adds support for more than one CPU in isolation script. Change-Id: I169766adf900289f4eaf955e1d12f4d3394f642c Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-rwxr-xr-xcommon/scripts/is-cpu-isolated.sh108
1 files changed, 63 insertions, 45 deletions
diff --git a/common/scripts/is-cpu-isolated.sh b/common/scripts/is-cpu-isolated.sh
index ddbebbf..2805659 100755
--- a/common/scripts/is-cpu-isolated.sh
+++ b/common/scripts/is-cpu-isolated.sh
@@ -16,6 +16,11 @@ STRESS_DURATION=5000
NON_ISOL_CPUS="0" #CPU not to isolate, zero will always be there as we can't stop ticks on boot CPU.
RESULT="PASS"
+# Global variables
+old_count=0
+new_count=0
+
+
# ROUTINES
debug_script=1
isdebug() {
@@ -244,37 +249,72 @@ isolate_cpu() {
for_each_isol_cpu create_dplane_cpuset
}
-# routine to get CPU isolation time
-get_isolation_duration() {
- isdebug echo ""
- isdebug echo ""
- isdebug echo "Capture Isolation time"
- isdebug echo "----------------------"
+count_interrupts_on_isol_cpus() {
+ temp=($*)
+ count=0
- isdebug echo "No. of samples requested:" $SAMPLE_COUNT", min isolation required:" $MIN_ISOLATION
- isdebug echo ""
+ for i in `echo $ISOL_CPU | sed 's/,/ /g'`; do
+ count=$(( $count + ${temp[i]} ))
+ done
- isdebug dump_interrupts
+ echo $count
+}
+
+# process interrupts
+refresh_interrupts() {
+ # Get interrupt count for all CPUs
+ interrupts=($(total_interrupts "ALL"))
- # Get initial count
- new_count=$(total_interrupts $ISOL_CPU)
- isdebug echo "initial count: " $new_count
+ # Find total count of all interrupts on isol CPUs
+ new_count=$(count_interrupts_on_isol_cpus ${interrupts[@]})
+ [ $1 ] && isdebug echo "Counts for all CPUs: ${interrupts[@]}, total isol-cpus interrupts: $new_count"
+}
+
+# Sense infinite isolation
+sense_infinite_isolation() {
+ # process interrupts
+ refresh_interrupts "print"
old_count=$new_count
- T2="$(date +%s)"
+
+ # Get time as a UNIX timestamp (seconds elapsed since Jan 1, 1970 0:00 UTC)
+ T1="$(date +%s)"
+
while [ $new_count -eq $old_count ]
do
- new_count=$(total_interrupts $ISOL_CPU)
+ # process interrupts
+ refresh_interrupts
+
ps h -C stress -o pid > /dev/null
if [ $? != 0 ]; then
- T=$(($(date +%s)-$T2))
- echo "Tick didn't got updated for stress duration:" $T
- echo "Probably in infinite mode, quiting test"
- echo "test_case_id:Min-isolation "$MIN_ISOLATION" secs result:"$RESULT" measurement:"$T" units:secs"
+ T2="$(date +%s)"
+ T=$(($T2-$T1))
+
+ echo "Quitting. Infinite Isolation detected: No interrupts for last: $T seconds"
+ echo "test_case_id:Min-isolation $MIN_ISOLATION secs result:$RESULT measurement:$T units:secs"
exit
fi
done
+ # Interrupted, dump interrupts
+ isdebug dump_interrupts 1
+}
+
+# routine to get CPU isolation time
+get_isolation_duration() {
+ isdebug echo ""
+ isdebug echo ""
+ isdebug echo "Capture Isolation time"
+ isdebug echo "----------------------"
+
+ isdebug echo "No. of samples requested:" $SAMPLE_COUNT", min isolation required:" $MIN_ISOLATION
+ isdebug echo ""
+
+ isdebug dump_interrupts
+
+ # Sense infinite isolation
+ sense_infinite_isolation
+
isdebug echo "count locked: " $new_count
# Get time as a UNIX timestamp (seconds elapsed since Jan 1, 1970 0:00 UTC)
@@ -288,43 +328,21 @@ get_isolation_duration() {
do
let x=x+1
- # Interrupted, dump interrupts
- isdebug dump_interrupts 1
-
T1=$T2
isdebug echo "Start Time in seconds: ${T1}"
# sometimes there are continuous ticks, skip them by sleeping for 100 ms.
sleep .1
- # get count again after continuous ticks are skiped
- old_count=$(total_interrupts $ISOL_CPU)
- new_count=$old_count
-
+ # Sense infinite isolation
+ sense_infinite_isolation
T2="$(date +%s)"
- while [ $new_count -eq $old_count ]
- do
- new_count=$(total_interrupts $ISOL_CPU)
- ps h -C stress -o pid > /dev/null
- if [ $? != 0 ]; then
- T=$(($(date +%s)-$T2))
- echo "Tick didn't got updated for stress duration:" $T
- echo "Probably in infinite mode, quiting test"
- echo "test_case_id:Min-isolation "$MIN_ISOLATION" secs result:PASS measurement:"$T" units:secs"
- exit
- fi
- done
-
- isdebug echo "sampling over: " $new_count
-
- T2="$(date +%s)"
- isdebug echo "End Time in seconds: ${T2}"
-
T=$(($T2-$T1))
- isdebug echo "Time in seconds: "
- echo $T
+ isdebug echo "End Time in seconds: ${T2}, time diff: $T"
isdebug echo ""
+
+ # Calculations to show results
let AVG=AVG+T
if [ $T -lt $MIN_ISOLATION -a $RESULT="PASS" ]; then