summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-06-27 15:18:07 +0530
committerFathi Boudra <fathi.boudra@linaro.org>2014-07-01 10:16:20 +0000
commit2ea43f8fef6b8416a7b680f08c15c0ef6269c8f2 (patch)
tree087d66fc27ca207f0cccb6c9a8ce6ef1badbb84e
parent0dd4ad42e7882a0309b9d184d6ed69d7500d4c01 (diff)
is-cpu-isolated: Keep an eye on all possible interrupts
Until now we were only concerned about interruption from ticks and so were checking only interrupts from arch_timer. But there are few problems here: - To check which row belongs to tick-timer, we need to grep for a string. It can be "arch-timer", "twd", "NMI", etc for different platforms and so the script was never generic. - Also, interruption is possible from other peripherals, PPI, SPI, IPC, etc This patch adds in another AWK script to get total number of interrupts for any CPU (though it supports returning that for all CPUs at once, its not used currently). We use this instead of looking at tick-timer. Change-Id: I2aab004314459a928e5ebc505d03a4525957c40e Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-rwxr-xr-xcommon/scripts/is-cpu-isolated.sh71
1 files changed, 62 insertions, 9 deletions
diff --git a/common/scripts/is-cpu-isolated.sh b/common/scripts/is-cpu-isolated.sh
index d749582..7984fb5 100755
--- a/common/scripts/is-cpu-isolated.sh
+++ b/common/scripts/is-cpu-isolated.sh
@@ -35,11 +35,50 @@ isdebug() {
fi
}
-# routine to get tick count: Expects all CPUs to be online (otherwise column
-# number may get wrong)
-get_tick_count() { cat /proc/interrupts | grep arch_timer | grep 30 | sed 's/\s\+/ /g' | sed 's/^\s//g' | cut -d' ' -f$((2+$ISOL_CPU)) ; }
-#For testing script on: x86
-#get_tick_count() { cat /proc/interrupts | grep NMI | sed 's/\s\+/ /g' | sed 's/\s\+/ /g' | cut -d' ' -f$((2+$ISOL_CPU)) ; }
+# Find total number of interrupts for
+# - one CPU, pass cpu number as parameter
+# - all CPUs, pass "ALL" as parameter
+total_interrupts() {
+ awk -v isolate_cpu="$1" '
+ BEGIN {
+ line=0;
+ }
+
+ # Find total CPUs, do only on first row
+ NR==1 {
+ cpus = NF;
+ next;
+ }
+
+ # Fill array with interrupt counts
+ {
+ for (cpu = 0; cpu < cpus; cpu++) {
+ irqs[cpu, line] = $(cpu+2);
+ }
+ line++;
+ }
+
+ # Count total interrupts:
+ END {
+ for (cpu = 0; cpu < cpus; cpu++) {
+ for (j = 0; j < line; j++) {
+ count[cpu] += irqs[cpu,j];
+ # for debugging
+ # printf "%d: %d: %d\n",cpu, j,irqs[cpu,j];
+ }
+
+ if (isolate_cpu == "ALL")
+ printf "%d ",count[cpu]
+ else if (cpu == isolate_cpu)
+ printf "%d ",count[cpu]
+
+ }
+ printf "\n"
+ }
+
+ # File to process
+' /proc/interrupts
+}
# update list of all non-ISOL CPUs
update_non_isol_cpus() {
@@ -173,6 +212,14 @@ isolate_cpu() {
done
}
+dump_interrupts() {
+ [ ! $1 ] && printf "\n\nInitial dump of /proc/interrupts\n"
+ [ $1 ] && printf "\n\nInterrupted: new dump of /proc/interrupts\n"
+
+ cat /proc/interrupts
+ printf "\n\n"
+}
+
# routine to get CPU isolation time
get_isolation_duration() {
isdebug echo ""
@@ -183,14 +230,17 @@ get_isolation_duration() {
isdebug echo "No. of samples requested:" $SAMPLE_COUNT", min isolation required:" $MIN_ISOLATION
isdebug echo ""
- new_count=$(get_tick_count)
+ isdebug dump_interrupts
+
+ # Get initial count
+ new_count=$(total_interrupts $ISOL_CPU)
isdebug echo "initial count: " $new_count
old_count=$new_count
T2="$(date +%s)"
while [ $new_count -eq $old_count ]
do
- new_count=$(get_tick_count)
+ new_count=$(total_interrupts $ISOL_CPU)
ps h -C stress -o pid > /dev/null
if [ $? != 0 ]; then
T=$(($(date +%s)-$T2))
@@ -214,6 +264,9 @@ get_isolation_duration() {
do
let x=x+1
+ # Interrupted, dump interrupts
+ isdebug dump_interrupts 1
+
T1=$T2
isdebug echo "Start Time in seconds: ${T1}"
@@ -221,14 +274,14 @@ get_isolation_duration() {
sleep .1
# get count again after continuous ticks are skiped
- old_count=$(get_tick_count)
+ old_count=$(total_interrupts $ISOL_CPU)
new_count=$old_count
T2="$(date +%s)"
while [ $new_count -eq $old_count ]
do
- new_count=$(get_tick_count)
+ new_count=$(total_interrupts $ISOL_CPU)
ps h -C stress -o pid > /dev/null
if [ $? != 0 ]; then
T=$(($(date +%s)-$T2))