aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaresh Kamboju <naresh.kamboju@linaro.org>2014-12-05 17:27:39 +0530
committerNaresh Kamboju <naresh.kamboju@linaro.org>2014-12-05 17:27:39 +0530
commit2e04adeaf5c986a3ed6830e67d064e39e10b317b (patch)
treef1ec4f907374e8b15b328caa48ca51eb182cc6ee
big.LITTLE IKS test suites initial commit
big.LITTLE IKS test suites initial commit Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
-rw-r--r--Android.mk20
-rw-r--r--Makefile32
-rw-r--r--README144
-rw-r--r--TODO77
-rw-r--r--affinity_tools/Android.mk27
-rw-r--r--affinity_tools/Makefile11
-rw-r--r--affinity_tools/affinity_tools.c219
-rwxr-xr-xandroid-prebuilts/bl-agitatorbin0 -> 14320 bytes
-rwxr-xr-xbasic/governor.sh94
-rwxr-xr-xbasic/module.sh111
-rwxr-xr-xbasic/run-bl-basic-tests.sh30
-rwxr-xr-xbasic/switch.sh176
-rwxr-xr-xbasic/switcher-tests/100_switches.sh83
-rwxr-xr-xbasic/switcher-tests/fastswitch.sh59
-rwxr-xr-xbasic/switcher-tests/reswitch.sh90
-rwxr-xr-xbasic/switcher-tests/switcher-tests.sh26
-rwxr-xr-xbasic/switcher-tests/switcher_enable_disable.sh58
-rwxr-xr-xbasic/switcher-tests/switcher_off_hotplug_cpu.sh91
-rwxr-xr-xbasic/switcher-tests/try_rmmod.sh93
-rw-r--r--bl-agitator/Android.mk27
-rw-r--r--bl-agitator/Makefile11
-rw-r--r--bl-agitator/bl-agitator.c781
-rwxr-xr-xboot-a15/boot-a15.sh143
-rwxr-xr-xboot-a7/boot-a7.sh143
-rwxr-xr-xcache-coherency-switcher/cache-coherency-switcher.sh472
-rwxr-xr-xcluster-status/cluster-status.sh91
-rwxr-xr-xcpu_freq_vs_cluster_freq/cpu_freq_cope_on_cluster_freq.sh65
-rwxr-xr-xcpu_freq_vs_cluster_freq/cpu_freq_vs_cluster_freq.sh79
-rw-r--r--cpu_freq_vs_cluster_freq/inputfiles/cpu_freq_cope_on_cluster_freq_output_org.log40
-rwxr-xr-xdata-corruption-switcher/data-corruption-switcher.sh474
-rwxr-xr-xdata-corruption/data-corruption.sh109
-rw-r--r--data-corruption/images/boxes.ppm33
-rwxr-xr-xdisk-io-stress-switcher/disk-io-stress-switcher.sh435
-rwxr-xr-xinstall-scripts-android.sh51
-rw-r--r--install-scripts.mk33
-rwxr-xr-xinteractive-governor-test.sh141
-rwxr-xr-xmem-stress-switcher/mem-stress-switcher.sh471
-rwxr-xr-xperf-count-events/perf-disk-io-stress-switcher.sh457
-rwxr-xr-xperf-count-events/perf-mem-stress-switcher.sh493
-rwxr-xr-xrun_stress_switcher_tests.sh677
-rwxr-xr-xvfp-ffmpeg-switcher/vfp-ffmpeg-switcher.sh474
-rw-r--r--vfp-ffmpeg/inputfiles/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGGbin0 -> 73972 bytes
-rwxr-xr-xvfp-ffmpeg/vfp-ffmpeg.sh107
43 files changed, 7248 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..e6912d8
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,20 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Amit Pundir <amit.pundir@linaro.org>
+#
+
+include $(call all-subdir-makefiles)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..15ec529
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+DESTDIR ?= /
+TESTS=boot-a7/boot-a7.sh data-corruption/data-corruption.sh disk-io-stress-switcher/disk-io-stress-switcher.sh \
+ cache-coherency-switcher/cache-coherency-switcher.sh mem-stress-switcher/mem-stress-switcher.sh \
+ boot-a15/boot-a15.sh data-corruption-switcher/data-corruption-switcher.sh \
+ basic/switcher-tests/fastswitch.sh basic/switcher-tests/100_switches.sh basic/switcher-tests/switcher-tests.sh \
+ basic/switcher-tests/reswitch.sh basic/switcher-tests/try_rmmod.sh basic/run-bl-basic-tests.sh \
+ basic/governor.sh basic/module.sh basic/switch.sh bl-agitator/bl-agitator \
+ vfp-ffmpeg-switcher/vfp-ffmpeg-switcher.sh vfp-ffmpeg/vfp-ffmpeg.sh \
+ cluster-status/cluster-status.sh basic/switcher-tests/switcher_enable_disable.sh \
+ basic/switcher-tests/switcher_off_hotplug_cpu.sh cpu_freq_vs_cluster_freq/cpu_freq_cope_on_cluster_freq.sh \
+ cpu_freq_vs_cluster_freq/cpu_freq_vs_cluster_freq.sh \
+ perf-count-events/perf-disk-io-stress-switcher.sh perf-count-events/perf-mem-stress-switcher.sh \
+ interactive-governor-test.sh run_stress_switcher_tests.sh affinity_tools/affinity_tools
+
+DATA=data-corruption/images/boxes.ppm
+INPUT=vfp-ffmpeg/inputfiles/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG
+LOG_FILE=cpu_freq_vs_cluster_freq/inputfiles/cpu_freq_cope_on_cluster_freq_output_org.log
+
+all:
+ make CFLAGS=$(CFLAGS) -C bl-agitator
+ make CFLAGS=$(CFLAGS) -C affinity_tools
+
+clean:
+ make -C bl-agitator clean
+ make -C affinity_tools clean
+
+install:
+ mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/usr/share/testdata
+ cp $(TESTS) $(DESTDIR)/usr/bin
+ cp $(DATA) $(DESTDIR)/usr/share/testdata
+ cp $(INPUT) $(DESTDIR)/usr/share/testdata
+ cp $(LOG_FILE) $(DESTDIR)/usr/share/testdata
diff --git a/README b/README
new file mode 100644
index 0000000..e9a09d6
--- /dev/null
+++ b/README
@@ -0,0 +1,144 @@
+big.LITTLE switcher test suite
+------------------------------
+
+This test suite has been developed by Linaro. The goal of this test suite is
+to test big.LITTLE switching functionality and stress tests. The main focus
+is to test big.LITTLE switching while system switches it cores from A15 to A7
+and vice versa. It is compatible for both Android and Ubuntu.
+
+Get the source
+--------------
+
+https://linaro-private.git.linaro.org/gitweb?p=bL_tests/core-tests.git
+git clone ssh://username@linaro-private.git.linaro.org/srv/
+linaro-private.git.linaro.org/bL_tests/core-tests.git
+
+In the Package
+--------------
+
+Here is a short description of what is included in this package
+Android.mk
+ Android make support file
+android-prebuilts/*
+ Holds android pre-built ARM binary file bl-agitator. which will be
+ used by other test scripts for switching testcases.
+basic/*
+ Collections of basic big.LITTLE test
+bl-agitator/*
+ big.LITTLE agitator build support files
+boot-a15
+ This script ensures the given cores are running on a15
+boot-a7
+ This script ensures the given cores are running on a7
+cache-coherency-switcher
+ Test script to test cache-coherency among switching cores
+cpu_freq_vs_cluster_freq
+ Test script to test cpu freq in a given cluster should match with all
+ cpus belongs to the same cluster.
+data-corruption
+ Test case is to test data corruption with the help of md5sum
+data-corruption-switcher
+ This file is a collection of date corruption, random and periodic
+ switch test cases.
+disk-io-stress-switcher
+ This file is a collection of iozone, random and periodic switch test
+ cases.
+vfp-ffmpeg
+ This file is to test vfp feature in kernel by using ffmpeg tool.
+vfp-ffmpeg-switcher
+ This file is to test vfp feature in kernel by using ffmpeg tool
+ while random and periodic switching happens.
+install-scripts-android.sh
+ To install pre-built testcase on to MMC
+interactive-governor-test.sh
+ This test sets the interactive, or ondemand governor as appropriate,
+ and uses a tool to create stress on the system, and make sure that
+ the system automatically responds by moving cpus over to big, then
+ back to little when it's done.
+Makefile
+ To make and install
+mem-stress-switcher
+ This is pre-built binary memtester along with bigLITTLE switcher
+README
+ This document
+run_stress_switcher_tests.sh
+ A simple shell script to run all the test in sequence and report the
+ overall results
+perf-count-events
+ Test to count the perf events on clusters A7, A15 and switcher mode.
+
+Usage information
+-----------------
+
+These test cases would be available along with linaro development images of
+Ubuntu and Android.
+
+Find out these testscript location
+# which run_stress_switcher_tests.sh
+
+For usage information on each test script run xxxxfile.sh --help
+Example:
+# run_stress_switcher_tests.sh --help
+# mem-stress-switcher.sh --help
+
+complete run
+-------------
+
+It may take couple of hours, double check before you start
+# run_stress_switcher_tests.sh -a
+
+Individual run
+--------------
+
+# run_stress_switcher_tests.sh
+ usage: $0 [<option> <argument>] ..
+ Options: -a [Run all tests]
+ -b [Run all basic module and switcher tests]
+ -c [Run all cache-coherency tests]
+ -d [Run all data-corruption tests]
+ -i [Run all disk-io tests]
+ -g [Run all governor tests]
+ -m [Run all memory tests]
+ -s [Run only switcher tests]
+ -t <specify the test-id(s)> [Run the specified tests]
+ [ 1 : cache-coherency-a7]
+ [ 2 : cache-coherency-a15]
+ [ 3 : cache-coherency-switching]
+ [ 4 : data-corruption-a7]
+ [ 5 : data-corruption-a15]
+ [ 6 : data-corruption-switching]
+ [ 7 : disk-io-stress-a7]
+ [ 8 : disk-io-stress-a15]
+ [ 9 : disk-io-stress-switching]
+ [10 : mem-stress-a7]
+ [11 : mem-stress-a15]
+ [12 : mem-stress-switching]
+ [13 : bl-basic-tests]
+ [14 : switcher-tests]
+ [15 : interactive-governor-test]
+
+Results
+-------
+
+Full run test results summary
+# run_stress_switcher_tests.sh -a
+Summary ..
+Total Tests = 30
+Tests Passed = 30
+Tests Failed = 0
+
+Environment
+-----------
+
+Currently it can be run on four platforms
+1. Ubuntu w/ Reference switcher
+2. Android w/ Reference Switcher
+3. Ubuntu w/ Integrated switcher
+4. Android w/ Integrated Switcher
+
+Contact info
+------------
+
+Contact for more info and queries on the status of the project:
+Naresh Kamboju <naresh.kamboju@linaro.org>
+
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..9d3d2c2
--- /dev/null
+++ b/TODO
@@ -0,0 +1,77 @@
+Current test suite is designed for TC2 Hardware and RTSM (Fast-models).
+We currently in a process of making this test suite run on all kind of
+members platform.
+
+Following changes needs to be done to run other than TC2 and RTSM platforms
+
+1. “run_stress_switcher_tests.sh’
+
+code snippet
+------------
+
+        #TODO
+        # For TC2
+        if [ "$MODEL" = "V2P-CA15_CA7" ]; then
+                EACH_CPU="-c 0 -c 1"
+                NO_OF_CPUS="-n 0 1"
+        # For RTSM
+        else if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+                EACH_CPU="-c 0 -c 1 -c 2 -c 3"
+                NO_OF_CPUS="-n 0 1 2 3"
+        else
+                echo " Unknown architecture"
+                echo " Please add your architecture or model"
+                echo " Provide number of cpu info"
+                exit 1
+        fi
+        fi
+
+
+2. All switcher files
+
+This has limitation up to 4 cpus.
+if your platform has more than 4 cpus add extra cpu list here and
+
+ -n|--thread-switching)
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU0="-c $2";
+ shift;
+ else
+ echo "Error: Must specify at least one CPU on which thread has to be spawned"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU1="-c $2";
+ shift;
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU2="-c $2";
+ shift;
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU3="-c $2";
+ shift;
+ fi
+ ;;
+
+
+run_periodic_switcher() {
+...
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ bl-agitator -n $THREAD_CPU0 $THREAD_CPU1 $THREAD_CPU2 $THREAD_CPU3 -s $INTR &
+ BL_AGITATOR_PID=$!
+ fi
+...
+}
+
+run_random_switcher() {
+...
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ bl-agitator -n $THREAD_CPU0 $THREAD_CPU1 $THREAD_CPU2 $THREAD_CPU3 -s $INTR &
+ BL_AGITATOR_PID=$!
+ fi
+
+...
+}
diff --git a/affinity_tools/Android.mk b/affinity_tools/Android.mk
new file mode 100644
index 0000000..1d0442c
--- /dev/null
+++ b/affinity_tools/Android.mk
@@ -0,0 +1,27 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES:= affinity_tools.c
+LOCAL_MODULE := affinity_tools
+LOCAL_STATIC_LIBRARIES := libcutils libc
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_EXECUTABLE)
diff --git a/affinity_tools/Makefile b/affinity_tools/Makefile
new file mode 100644
index 0000000..fe07b7e
--- /dev/null
+++ b/affinity_tools/Makefile
@@ -0,0 +1,11 @@
+CROSS_COMPILE ?= arm-linux-gnueabi-
+CC = $(CROSS_COMPILE)gcc
+SOURCES = affinity_tools.c
+
+all: affinity_tools
+
+clean:
+ rm -f affinity_tools
+
+affinity_tools:
+ $(CC) $(SOURCES) $(CFLAGS) -lrt -lpthread -o affinity_tools
diff --git a/affinity_tools/affinity_tools.c b/affinity_tools/affinity_tools.c
new file mode 100644
index 0000000..33d88f5
--- /dev/null
+++ b/affinity_tools/affinity_tools.c
@@ -0,0 +1,219 @@
+/*
+ * affinity_tools - hog a cpu(s) a change affinity of a task
+ *
+ * Created by: Olivier Cozette, November 2012
+ * Copyright: (C) 2012 ARM Limited
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdbool.h>
+#include <sys/syscall.h>
+#include <stdlib.h> // for NULL
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdbool.h>
+
+#define CPU_MAX 32
+int hog_cpu_pid_nb;
+int hog_cpu_pids[CPU_MAX];
+
+void hog_cpu_kill(int sig)
+{
+ int i;
+ for (i = 0; i < hog_cpu_pid_nb; i++)
+ kill(hog_cpu_pids[i], SIGKILL);
+ exit(0);
+}
+
+bool setaffinity(int cpu, int pid)
+{
+ int mask = 1 << cpu;
+ int res;
+ res = syscall(__NR_sched_setaffinity, pid, sizeof(mask), &mask);
+ if (res < 0)
+ return false;
+ return true;
+}
+
+bool setmyaffinity(int cpu)
+{
+ return setaffinity(cpu, 0);
+}
+
+void hog_cpu(int nb, int * cpu)
+{
+ hog_cpu_pid_nb = 0;
+ signal(SIGUSR1, hog_cpu_kill);
+ while (nb > 1)
+ {
+ nb--;
+ hog_cpu_pids[hog_cpu_pid_nb] = fork();
+ if (hog_cpu_pids[hog_cpu_pid_nb] == 0)
+ {
+ printf("#HOG on cpu %d\n", cpu[nb]);
+ if (!setmyaffinity(cpu[nb]))
+ exit(1);
+ while (1)
+ ;
+ }
+ hog_cpu_pid_nb++;
+ }
+ nb--;
+ if (!setmyaffinity(cpu[nb]))
+ exit(1);
+ while (1)
+ ;
+
+}
+
+void task_set(int nb, int * cpu, int pid)
+{
+ int mask = 0;
+ int res, err;
+ printf("# Set affinity of pid %d to cpu", pid);
+ while (nb > 0)
+ {
+ nb--;
+ mask |= (1 << cpu[nb]);
+ printf(" %d", cpu[nb]);
+ }
+ printf("\n");
+ res = syscall(__NR_sched_setaffinity, pid, sizeof(mask), &mask);
+ if (res < 0)
+ printf("# Can't set affinity of pid %d to %d\n", pid, mask);
+}
+
+
+bool read_midr(int cpu, unsigned int * implementer, unsigned int * part)
+{
+ FILE * fd;
+ bool all_processor = false;
+ int current_processor = -1;
+ char str[256];
+ *implementer = 0;
+ *part = 0;
+ if (!setmyaffinity(cpu))
+ return false;
+ fd = fopen("/proc/cpuinfo", "r");
+ if (fd == NULL)
+ return false;
+ while ((*part == 0) || (*implementer == 0))
+ {
+ char * number;
+ while (fscanf(fd, "%*[\n]") > 0)
+ ;
+ if (fscanf(fd, "%[^\n]", str) < 1)
+ break;
+ if (strncmp(str, "processor", strlen("processor")) == 0)
+ {
+ all_processor = true;
+ sscanf(strchr(str, ':') + 2, "%d", &current_processor);
+ }
+ if ((all_processor) && (cpu != current_processor))
+ continue;
+ if ((strstr(str, "CPU part") == NULL)
+ && (strstr(str, "CPU implementer") == NULL))
+ continue;
+ number = strchr(str, ':') + 1;
+ if (number == NULL)
+ continue;
+ while (*number == ' ')
+ number++;
+ if (strstr(str, "CPU part") != NULL)
+ sscanf(number, "0x%x", part);
+ else
+ sscanf(number, "0x%x", implementer);
+ }
+ fclose(fd);
+ if ((*part == 0) || (*implementer == 0))
+ return false;
+ return true;
+}
+
+
+int main(int argc, char **argv)
+{
+ int nb;
+ int cpu[CPU_MAX];
+ int taskset = false;
+ const char * cpu_list;
+ printf("%s Created by: Olivier Cozette, November 2012 Copyright: (C) 2012 ARM Limited\n", argv[0]);
+ if (argc < 2)
+ {
+ printf("Usage:\n");
+ printf("\t CPU\t\tWill hog the cpu CPU cpu is a comma separated list\n");
+ printf("\t -pc CPU PID\tWill set affinity of PID to CPU is a comma separated list\n");
+ printf("\t -part CPU,IMPLEMENTER,PART\tWill exit 0 if the CPU is this one or exit 1 otherwise\n");
+ printf("Example: \"%s -part 0,0x41,0xc07\" will exit 0 if the CPU 0 is an A7\n", argv[0]);
+ printf("Example: \"%s -part 0,0x41,0xc0f\" will exit 0 if the CPU 0 is an A15\n", argv[0]);
+ printf("\t -showpart\tWill display part for all CPU\n");
+ printf("Example: \"%s -showpart\" \n0,0x41,0xc0f,1,0x41,0xc0f,2,0x41,0xc07,3,0x41,0xc07,4.0x41,0xc07\n", argv[0]);
+ printf("Meaning CPU0,1 are A15 and CPU2,3,4 are A7\n");
+ return 0;
+ }
+
+ cpu_list = argv[1];
+ if ((strcmp(argv[1], "-part") == 0) && (argc > 2))
+ {
+ unsigned int cpu, part, implementer;
+ unsigned int real_part, real_implementer;
+ if (sscanf(argv[2], "%d,0x%x,0x%x", &cpu, &implementer, &part) < 3)
+ {
+ printf("The option \"-part\" need to be followed by \"CPU,IMPLEMENTER,PART\" and it was <%s>\n", argv[2]);
+ printf("where CPU is an integer and where IMPLEMENTER and PART are in the form 0x[0-9]*\n");
+ exit(1);
+ }
+ if (!read_midr(cpu, &real_implementer, &real_part))
+ exit(1);
+ if ((real_implementer != implementer) || (real_part != part))
+ exit(1);
+ exit(0);
+ }
+ if (strcmp(argv[1], "-showpart") == 0)
+ {
+ bool first = true;
+ unsigned int cpu, part, implementer;
+ for (cpu = 0; cpu < 31; cpu++)
+ {
+ if (!read_midr(cpu, &implementer, &part))
+ continue;
+ if (!first)
+ printf(",");
+ first = false;
+ printf("%d,0x%x,0x%x", cpu, implementer, part);
+ }
+ printf("\n");
+ exit(0);
+ }
+ if (strcmp(argv[1], "-pc") == 0)
+ {
+ taskset = true;
+ if (argc < 4)
+ {
+ printf("need to specify CPU list and PID\n");
+ return 1;
+ }
+ cpu_list = argv[2];
+ }
+ nb = sscanf(cpu_list, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
+ &cpu[0], &cpu[1], &cpu[2], &cpu[3], &cpu[4], &cpu[5], &cpu[6], &cpu[7],
+ &cpu[8], &cpu[9], &cpu[10], &cpu[11], &cpu[12], &cpu[13], &cpu[14], &cpu[15]);
+
+ if (taskset)
+ task_set(nb, cpu, atol(argv[3]));
+ else
+ hog_cpu(nb, cpu);
+
+ return 0;
+}
diff --git a/android-prebuilts/bl-agitator b/android-prebuilts/bl-agitator
new file mode 100755
index 0000000..39321e4
--- /dev/null
+++ b/android-prebuilts/bl-agitator
Binary files differ
diff --git a/basic/governor.sh b/basic/governor.sh
new file mode 100755
index 0000000..a54f82c
--- /dev/null
+++ b/basic/governor.sh
@@ -0,0 +1,94 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# Author: Paul Larson <paul.larson@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+insert_bl_module()
+{
+ #SETUP
+ #Remove the module just in case
+ rmmod arm_bl_cpufreq > /dev/null 2>&1
+ rmmod cpufreq_ondemand > /dev/null 2>&1
+
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+ if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+ fi
+ fi
+
+ echo "Loading cpufreq driver module..."
+ insmod $MOD_LOCATION
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "not able to insert arm-bl-cpufreq.ko module"
+ fi
+}
+
+# insert bl module is intended for RTSM
+MODEL=`cat /proc/device-tree/model`
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ insert_bl_module
+fi
+
+echo "Trying to set invalid governor..."
+TCID=bl-governor-invalid01
+echo xxxxxx > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ERR_CODE=$?
+#This one should fail
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : PASS"
+else
+ echo "$TCID : FAIL"
+fi
+
+echo "Setting governor to userspace on all cores..."
+TCID=bl-governor-userspace01
+ERR_CODE=0
+GOVERNOR="userspace"
+for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+do echo $GOVERNOR > $file
+ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+echo "Verifying governors set to userspace on all cores..."
+TCID=bl-governor-userspace02
+ERR_CODE=0
+for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+do
+grep userspace $file > /dev/null
+ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
diff --git a/basic/module.sh b/basic/module.sh
new file mode 100755
index 0000000..48c0f60
--- /dev/null
+++ b/basic/module.sh
@@ -0,0 +1,111 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# Author: Paul Larson <paul.larson@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+# this test is intended for RTSM
+#SETUP
+#Remove the module just in case
+rmmod arm_bl_cpufreq > /dev/null 2>&1
+rmmod cpufreq_ondemand > /dev/null 2>&1
+
+ANDROID_MOD_PATH=/system/modules
+UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+fi
+fi
+
+echo "Loading cpufreq driver module..."
+TCID=bl-mod-load01
+insmod $MOD_LOCATION
+ERR_CODE=$?
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+echo "Verifying cpufreq driver module loaded..."
+TCID=bl-mod-load02
+lsmod |grep arm_bl_cpufreq > /dev/null
+ERR_CODE=$?
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+echo "Loading cpufreq driver module when already loaded..."
+TCID=bl-mod-load03
+insmod $MOD_LOCATION
+ERR_CODE=$?
+#This one should fail
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : PASS"
+else
+ echo "$TCID : FAIL"
+fi
+
+echo "Unloading cpufreq driver module..."
+TCID=bl-mod-unload01
+rmmod arm_bl_cpufreq
+ERR_CODE=$?
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+echo "Verifying cpufreq driver module unloaded..."
+TCID=bl-mod-unload02
+lsmod |grep arm_bl_cpufreq > /dev/null
+ERR_CODE=$?
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : PASS"
+else
+ echo "$TCID : FAIL"
+fi
+
+echo "Reloading cpufreq driver module..."
+TCID=bl-mod-reload01
+insmod $MOD_LOCATION
+ERR_CODE=$?
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+echo "Verifying cpufreq driver module loaded after reload..."
+TCID=bl-mod-reload02
+lsmod |grep arm_bl_cpufreq > /dev/null
+ERR_CODE=$?
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+
diff --git a/basic/run-bl-basic-tests.sh b/basic/run-bl-basic-tests.sh
new file mode 100755
index 0000000..29d9a53
--- /dev/null
+++ b/basic/run-bl-basic-tests.sh
@@ -0,0 +1,30 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# Author: Paul Larson <paul.larson@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+#if we do not follow sequential execution test may fail
+
+# this module.sh test is intended for RTSM
+MODEL=`cat /proc/device-tree/model`
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ module.sh
+fi
+
+governor.sh
+switch.sh
diff --git a/basic/switch.sh b/basic/switch.sh
new file mode 100755
index 0000000..8750ae4
--- /dev/null
+++ b/basic/switch.sh
@@ -0,0 +1,176 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# Author: Paul Larson <paul.larson@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+insert_bl_module()
+{
+ #SETUP
+ #Remove the module just in case
+ rmmod arm_bl_cpufreq > /dev/null 2>&1
+ rmmod cpufreq_ondemand > /dev/null 2>&1
+
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+ if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+ fi
+ fi
+
+ echo "Loading cpufreq driver module..."
+ insmod $MOD_LOCATION
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "not able to insert arm-bl-cpufreq.ko module"
+ fi
+}
+
+# insert bl module is intended for RTSM
+MODEL=`cat /proc/device-tree/model`
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ insert_bl_module
+fi
+
+BIG=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+LITTLE=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+
+ERR_CODE=0
+echo "Initially set all cores to a15..."
+TCID=bl-switch-all-a15
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $BIG > $file
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+# consider cpuinfo_transition_latency before checking
+usleep 50000
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do mode=`cat $file`
+ [ $mode = $BIG ]
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+ERR_CODE=0
+echo "Switch all cores from a15 to a7..."
+TCID=bl-switch-all-a15-a7
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $LITTLE > $file
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+# consider cpuinfo_transition_latency before checking
+usleep 50000
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do mode=`cat $file`
+ [ $mode = $LITTLE ]
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+ERR_CODE=0
+echo "Switch all cores from a7 to a7..."
+TCID=bl-switch-all-a7-a7
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $LITTLE > $file
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+# consider cpuinfo_transition_latency before checking
+usleep 50000
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do mode=`cat $file`
+ [ $mode = $LITTLE ]
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+ERR_CODE=0
+echo "Switch all cores from a7 to a15..."
+TCID=bl-switch-all-a7-a15
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $BIG > $file
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+# consider cpuinfo_transition_latency before checking
+usleep 50000
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do mode=`cat $file`
+ [ $mode = $BIG ]
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
+
+ERR_CODE=0
+echo "Switch all cores from a15 to a15..."
+TCID=bl-switch-all-a15-a15
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $BIG > $file
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+# consider cpuinfo_transition_latency before checking
+usleep 50000
+
+for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do mode=`cat $file`
+ [ $mode = $BIG ]
+ ERR_CODE=$(( $ERR_CODE+$? ))
+done
+
+if [ $ERR_CODE -ne 0 ]; then
+ echo "$TCID : FAIL"
+else
+ echo "$TCID : PASS"
+fi
diff --git a/basic/switcher-tests/100_switches.sh b/basic/switcher-tests/100_switches.sh
new file mode 100755
index 0000000..6db7476
--- /dev/null
+++ b/basic/switcher-tests/100_switches.sh
@@ -0,0 +1,83 @@
+# This script simply switch 100 times between big and little
+
+echo "100_switches : switch 100 times between big and little"
+
+insert_bl_module()
+{
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+ if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+ fi
+ fi
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+ if [ -z "$CPU_FREQ_KM" ]; then
+ insmod $MOD_LOCATION
+ fi
+}
+
+# insert bl module is intended for RTSM
+MODEL=`cat /proc/device-tree/model`
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ insert_bl_module
+fi
+
+BIG=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+LITTLE=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+
+switch_to_big () {
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $BIG > $file
+ done
+
+ # consider cpuinfo_transition_latency before checking
+ usleep 50000
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do freq=`cat $file`
+ if [ "$freq" -eq "$BIG" ]
+ then
+ echo "Switch to big with success"
+ else
+ echo ERROR : $freq
+ exit 1
+ fi
+ done
+}
+
+switch_to_little () {
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $LITTLE > $file
+ done
+
+ # consider cpuinfo_transition_latency before checking
+ usleep 50000
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do freq=`cat $file`
+ if [ "$freq" -eq "$LITTLE " ]
+ then
+ echo "Switch to big with success"
+ else
+ echo ERROR : $freq
+ exit 1
+ fi
+ done
+}
+
+i=0
+while [ $i -lt 100 ]; do
+ switch_to_little
+ switch_to_big
+ i=$(($i + 1))
+done
+
+echo "SUCCESS!!"
+exit 0
diff --git a/basic/switcher-tests/fastswitch.sh b/basic/switcher-tests/fastswitch.sh
new file mode 100755
index 0000000..b144f3c
--- /dev/null
+++ b/basic/switcher-tests/fastswitch.sh
@@ -0,0 +1,59 @@
+# This script switch 100 times between big and little without waiting between
+# switches
+
+echo "fastswitch : switch 100 times between big and little without waiting \
+between switches"
+
+insert_bl_module()
+{
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+ if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+ fi
+ fi
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+ if [ -z "$CPU_FREQ_KM" ]; then
+ insmod $MOD_LOCATION
+ fi
+}
+
+# insert bl module is intended for RTSM
+MODEL=`cat /proc/device-tree/model`
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ insert_bl_module
+fi
+
+BIG=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+LITTLE=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+
+fastswitch_to_big () {
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $BIG > $file
+ echo "Switch to big"
+ done
+}
+
+fastswitch_to_little () {
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $LITTLE > $file
+ echo "Switch to little"
+ done
+}
+
+i=0
+while [ $i -lt 100 ]; do
+ fastswitch_to_little
+ # consider cpuinfo_transition_latency before switching again to big
+ usleep 50000
+ fastswitch_to_big
+ i=$(($i + 1))
+done
+
+echo "SUCCESS!!"
+exit 0
diff --git a/basic/switcher-tests/reswitch.sh b/basic/switcher-tests/reswitch.sh
new file mode 100755
index 0000000..035dc5b
--- /dev/null
+++ b/basic/switcher-tests/reswitch.sh
@@ -0,0 +1,90 @@
+# This script switch 5 times on the same cluster, checking switcher behavior is
+# consistent
+
+echo "reswitch : switch 5 times on the same cluster, and check if switcher \
+behavior is consistent"
+
+insert_bl_module()
+{
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+ if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+ fi
+ fi
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+ if [ -z "$CPU_FREQ_KM" ]; then
+ insmod $MOD_LOCATION
+ fi
+}
+
+# insert bl module is intended for RTSM
+MODEL=`cat /proc/device-tree/model`
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ insert_bl_module
+fi
+
+BIG=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+LITTLE=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+
+switch_to_big () {
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $BIG > $file
+ done
+
+ # consider cpuinfo_transition_latency before checking
+ usleep 50000
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do freq=`cat $file`
+ if [ "$freq" -eq "$BIG" ]
+ then
+ echo "Switch to big with success"
+ else
+ echo ERROR : $freq
+ exit 1
+ fi
+ done
+}
+
+switch_to_little () {
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $LITTLE > $file
+ done
+
+ # consider cpuinfo_transition_latency before checking
+ usleep 50000
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do freq=`cat $file`
+ if [ "$freq" -eq "$LITTLE " ]
+ then
+ echo "Switch to big with success"
+ else
+ echo ERROR : $freq
+ exit 1
+ fi
+ done
+}
+
+i=0
+while [ $i -lt 5 ]; do
+ switch_to_little
+ i=$(($i + 1))
+done
+
+i=0
+while [ $i -lt 5 ]; do
+ switch_to_big
+ i=$(($i + 1))
+done
+
+echo "SUCCESS!!"
+exit 0
diff --git a/basic/switcher-tests/switcher-tests.sh b/basic/switcher-tests/switcher-tests.sh
new file mode 100755
index 0000000..58b1623
--- /dev/null
+++ b/basic/switcher-tests/switcher-tests.sh
@@ -0,0 +1,26 @@
+tests_dir=$(dirname $0)
+
+MODEL=`cat /proc/device-tree/model`
+
+echo "===== 100_switches.sh ====="
+${tests_dir}/100_switches.sh
+
+echo "===== reswitch.sh ====="
+${tests_dir}/reswitch.sh
+
+echo "===== fastswitch.sh ====="
+${tests_dir}/fastswitch.sh
+
+# For RTSM platform
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ echo "===== try_rmmod.sh ====="
+ ${tests_dir}/try_rmmod.sh
+fi
+
+# For TC2 platform
+if [ "$MODEL" = "V2P-CA15_CA7" ]; then
+ echo "===== switcher_enable_disable.sh ====="
+ ${tests_dir}/switcher_enable_disable.sh
+ echo "===== switcher_off_hotplug_cpu.sh ====="
+ ${tests_dir}/switcher_off_hotplug_cpu.sh
+fi
diff --git a/basic/switcher-tests/switcher_enable_disable.sh b/basic/switcher-tests/switcher_enable_disable.sh
new file mode 100755
index 0000000..e859aeb
--- /dev/null
+++ b/basic/switcher-tests/switcher_enable_disable.sh
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+# ==== switcher_enable_disable.sh description ====
+# new feature "CONFIG_BL_SWITCHER=y" is added in kernel.
+# enable and disable switcher can be done in run time.
+# cat /sys/kernel/bL_switcher/active
+# switcher_enable_disable.sh disable and enable switcher 100 times.
+
+ERR_CODE=0
+switcher_disable ()
+{
+ echo 0 > /sys/kernel/bL_switcher/active
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "not able to disable switcher"
+ echo "switcher_enable_disable.sh FAILED"
+ exit 1
+ fi
+}
+
+switcher_enable ()
+{
+ echo 1 > /sys/kernel/bL_switcher/active
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "not able to enable switcher"
+ echo "switcher_enable_disable.sh FAILED"
+ exit 1
+ fi
+}
+
+i=0
+while [ $i -lt 100 ]; do
+ switcher_disable
+ usleep 50000
+ switcher_enable
+ i=$(($i + 1))
+done
+
+echo "switcher_enable_disable.sh SUCCESS!!"
+exit 0
diff --git a/basic/switcher-tests/switcher_off_hotplug_cpu.sh b/basic/switcher-tests/switcher_off_hotplug_cpu.sh
new file mode 100755
index 0000000..ef839a7
--- /dev/null
+++ b/basic/switcher-tests/switcher_off_hotplug_cpu.sh
@@ -0,0 +1,91 @@
+#
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+# ==== switcher_off_hotplug_cpu.sh description ====
+# when switcher is disabled in run time, we can get cpu2, cpu3 and cpu4 also online
+# total we can see 5 cpus online. this test will hot-plug cpus 1,2,3 and 4.
+# hot-plug cpus randomly one after other for 100 loops on each four different ways.
+# ensure there would not be any kernel crash
+# enable back the switcher after test
+
+echo 0 > /sys/kernel/bL_switcher/active
+i=0
+while [ $i -lt 100 ];
+do
+echo 0 > /sys/devices/system/cpu/cpu1/online
+echo 0 > /sys/devices/system/cpu/cpu2/online
+echo 0 > /sys/devices/system/cpu/cpu3/online
+echo 0 > /sys/devices/system/cpu/cpu4/online
+echo 1 > /sys/devices/system/cpu/cpu1/online
+echo 1 > /sys/devices/system/cpu/cpu2/online
+echo 1 > /sys/devices/system/cpu/cpu3/online
+echo 1 > /sys/devices/system/cpu/cpu4/online
+i=$(($i + 1))
+done
+echo 1 > /sys/kernel/bL_switcher/active
+
+echo 0 > /sys/kernel/bL_switcher/active
+i=0
+while [ $i -lt 100 ];
+do
+echo 0 > /sys/devices/system/cpu/cpu1/online
+echo 1 > /sys/devices/system/cpu/cpu1/online
+echo 0 > /sys/devices/system/cpu/cpu2/online
+echo 1 > /sys/devices/system/cpu/cpu2/online
+echo 0 > /sys/devices/system/cpu/cpu3/online
+echo 1 > /sys/devices/system/cpu/cpu3/online
+echo 0 > /sys/devices/system/cpu/cpu4/online
+echo 1 > /sys/devices/system/cpu/cpu4/online
+i=$(($i + 1))
+done
+echo 1 > /sys/kernel/bL_switcher/active
+
+echo 0 > /sys/kernel/bL_switcher/active
+i=0
+while [ $i -lt 100 ];
+do
+echo 0 > /sys/devices/system/cpu/cpu1/online
+echo 0 > /sys/devices/system/cpu/cpu2/online
+echo 1 > /sys/devices/system/cpu/cpu2/online
+echo 1 > /sys/devices/system/cpu/cpu1/online
+echo 0 > /sys/devices/system/cpu/cpu3/online
+echo 0 > /sys/devices/system/cpu/cpu4/online
+echo 1 > /sys/devices/system/cpu/cpu4/online
+echo 1 > /sys/devices/system/cpu/cpu3/online
+i=$(($i + 1))
+done
+echo 1 > /sys/kernel/bL_switcher/active
+
+echo 0 > /sys/kernel/bL_switcher/active
+i=0
+while [ $i -lt 100 ];
+do
+echo 0 > /sys/devices/system/cpu/cpu3/online
+echo 0 > /sys/devices/system/cpu/cpu4/online
+echo 1 > /sys/devices/system/cpu/cpu4/online
+echo 1 > /sys/devices/system/cpu/cpu3/online
+echo 0 > /sys/devices/system/cpu/cpu1/online
+echo 0 > /sys/devices/system/cpu/cpu2/online
+echo 1 > /sys/devices/system/cpu/cpu2/online
+echo 1 > /sys/devices/system/cpu/cpu1/online
+i=$(($i + 1))
+done
+echo 1 > /sys/kernel/bL_switcher/active
+echo "SUCCESS!!"
+exit 0
diff --git a/basic/switcher-tests/try_rmmod.sh b/basic/switcher-tests/try_rmmod.sh
new file mode 100755
index 0000000..76705a0
--- /dev/null
+++ b/basic/switcher-tests/try_rmmod.sh
@@ -0,0 +1,93 @@
+# This script try to remove mod in different configurations
+
+echo "try_rmmod : try to remove mod in different configurations"
+
+REINSMOD=1
+ANDROID_MOD_PATH=/system/modules
+UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ CPU_FREQ_KM=`lsmod | busybox grep cpufreq | busybox awk '{print $1}'`
+else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+fi
+fi
+
+if ! [ -d /sys/devices/system/cpu/cpu0/cpufreq ]; then
+ insmod $MOD_LOCATION
+ REINSMOD=0
+fi
+
+BIG=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+LITTLE=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+
+switch_to_big () {
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $BIG > $file
+ done
+
+ # consider cpuinfo_transition_latency before checking
+ usleep 50000
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do freq=`cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq`
+ if [ "$freq" -eq "$BIG" ]
+ then
+ echo "Switch to big with success"
+ else
+ echo ERROR : $freq
+ exit 1
+ fi
+ done
+}
+
+switch_to_little () {
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
+ do echo $LITTLE > $file
+ done
+
+ # consider cpuinfo_transition_latency before checking
+ usleep 50000
+
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do freq=`cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq`
+ if [ "$freq" -eq "$LITTLE " ]
+ then
+ echo "Switch to big with success"
+ else
+ echo ERROR : $freq
+ exit 1
+ fi
+ done
+}
+
+switch_to_little
+rmmod arm-bl-cpufreq
+if lsmod | grep arm_bl_cpufreq > /dev/null
+ then
+ echo "ERROR : failed to remove module (little)"
+ exit 1
+fi
+
+insmod $MOD_LOCATION
+switch_to_big
+rmmod arm-bl-cpufreq
+if lsmod | grep arm_bl_cpufreq > /dev/null
+ then
+ echo "ERROR : failed to remove module (big)"
+ exit 1
+fi
+
+if [ "$REINSMOD" -eq "1" ]
+ then
+ insmod $MOD_LOCATION
+fi
+
+echo "SUCCESS!!"
+exit 0
diff --git a/bl-agitator/Android.mk b/bl-agitator/Android.mk
new file mode 100644
index 0000000..7ff0f5f
--- /dev/null
+++ b/bl-agitator/Android.mk
@@ -0,0 +1,27 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Amit Pundir <amit.pundir@linaro.org>
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES:= bl-agitator.c
+LOCAL_MODULE := bl-agitator
+LOCAL_STATIC_LIBRARIES := libcutils libc
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_EXECUTABLE)
diff --git a/bl-agitator/Makefile b/bl-agitator/Makefile
new file mode 100644
index 0000000..38c747e
--- /dev/null
+++ b/bl-agitator/Makefile
@@ -0,0 +1,11 @@
+CROSS_COMPILE ?= arm-linux-gnueabi-
+CC = $(CROSS_COMPILE)gcc
+SOURCES = bl-agitator.c
+
+all: bl-agitator
+
+clean:
+ rm -f bl-agitator
+
+bl-agitator:
+ $(CC) $(SOURCES) $(CFLAGS) -lrt -lpthread -o bl-agitator
diff --git a/bl-agitator/bl-agitator.c b/bl-agitator/bl-agitator.c
new file mode 100644
index 0000000..992c2d0
--- /dev/null
+++ b/bl-agitator/bl-agitator.c
@@ -0,0 +1,781 @@
+/*
+ * bl-agitator.c
+ *
+ * big.LITTLE tool to interface with kernel's cpufreq.
+ *
+ * - sysfs helpers were grabbed from cpufrequtils-008
+ * (with minor cosmetic tweaks). That code belongs to:
+ * Dominik Brodowski <linux@dominikbrodowski.de>
+ *
+ * Licensed under the terms of the GNU General Public License version 2.
+ *
+ * Complain to: Omar Ramirez Luna <omar.luna@linaro.org>
+ */
+
+#define _GNU_SOURCE
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#define SYSFS_CPU "/sys/devices/system/cpu/"
+#define MAX_LINE 255
+#define LINE_LEN 10
+#define PATH_MAX_LEN 255
+
+#define DEFAULT_LIMIT 1000 /* msecs for random switching */
+
+static int verbose;
+
+#define dbg(err, fmt ...) \
+do { \
+ if (err || verbose) \
+ printf(fmt); \
+} while (0) \
+
+struct bl_properties {
+ int cpu_max;
+ int cpuid;
+ int used;
+ unsigned long big_freq;
+ unsigned long little_freq;
+
+ pthread_t thread;
+};
+
+struct bl_properties *cpu_props;
+
+static int ind_switch;
+static char *frequency;
+static char *governor;
+static char *switch_period;
+static char *seed;
+static char *limit;
+static int info;
+static int threaded;
+static int sync_transition;
+
+static struct timespec start;
+static int used_cnt;
+static int transition_cnt;
+
+pthread_mutex_t mutex;
+pthread_cond_t count;
+
+/* cpufrequtils-008 */
+
+/* helper function to read file from /sys into given buffer */
+/* fname is a relative path under "cpuX/cpufreq" dir */
+unsigned int sysfs_read_file(unsigned int cpu, const char *fname, char *buf, size_t buflen)
+{
+ char path[PATH_MAX_LEN];
+ int fd;
+ ssize_t numread;
+
+ snprintf(path, sizeof(path), SYSFS_CPU "cpu%u/cpufreq/%s", cpu, fname);
+
+ if ((fd = open(path, O_RDONLY)) == -1) {
+ dbg(1, "failed to open %s, errno %d\n", path, errno);
+ return fd;
+ }
+
+ numread = read(fd, buf, buflen - 1);
+ if (numread < 1) {
+ close(fd);
+ dbg(1, "failed to read %s, errno %d\n", fname, errno);
+ return -EIO;
+ }
+
+ buf[numread] = '\0';
+ close(fd);
+
+ return numread;
+}
+
+/* helper function to write a new value to a /sys file */
+/* fname is a relative path under "cpuX/cpufreq" dir */
+unsigned int sysfs_write_file(unsigned int cpu, const char *fname, const char *value, size_t len)
+{
+ char path[PATH_MAX_LEN];
+ int fd;
+ ssize_t numwrite;
+
+ snprintf(path, sizeof(path), SYSFS_CPU "cpu%u/cpufreq/%s", cpu, fname);
+
+ if ((fd = open(path, O_WRONLY)) == -1) {
+ dbg(1, "failed to open %s, errno %d\n", path, errno);
+ return fd;
+ }
+
+ numwrite = write(fd, value, len);
+ if (numwrite < 1) {
+ close(fd);
+ dbg(1, "failed to write %s, errno %d\n", fname, errno);
+ return numwrite;
+ }
+
+ close(fd);
+
+ return numwrite;
+}
+
+static unsigned int count_cpus(void)
+{
+ FILE *fp;
+ char value[LINE_LEN];
+ unsigned int ret = 0;
+ unsigned int cpunr = 0;
+
+ fp = fopen("/proc/stat", "r");
+ if(!fp) {
+ printf("Couldn't count the number of CPUs (%s: err %d), assuming 1\n", "/proc/stat", errno);
+ return 1;
+ }
+
+ while (!feof(fp)) {
+ if (!fgets(value, LINE_LEN, fp))
+ continue;
+ value[LINE_LEN - 1] = '\0';
+ if (strlen(value) < (LINE_LEN - 2))
+ continue;
+ if (strstr(value, "cpu "))
+ continue;
+ if (sscanf(value, "cpu%d ", &cpunr) != 1)
+ continue;
+ if (cpunr > ret)
+ ret = cpunr;
+ }
+ fclose(fp);
+
+ /* cpu count starts from 0, on error return 1 (UP) */
+ return ret + 1;
+}
+
+
+void thread_transition_barrier()
+{
+ pthread_mutex_lock(&mutex);
+
+ transition_cnt++;
+
+ if (transition_cnt != used_cnt) {
+ pthread_cond_wait(&count, &mutex);
+ } else {
+ transition_cnt = 0;
+ pthread_cond_broadcast(&count);
+ }
+
+ pthread_mutex_unlock(&mutex);
+}
+
+/* big.LITTLE helpers */
+
+static char *_bl_name(struct bl_properties blp, unsigned long freq)
+{
+ if (freq == blp.big_freq)
+ return "big";
+
+ if (freq == blp.little_freq)
+ return "LITTLE";
+
+ return "unknown";
+}
+
+static int set_affinity(struct bl_properties *blp)
+{
+ cpu_set_t cpuset;
+
+ CPU_ZERO(&cpuset);
+ CPU_SET(blp->cpuid, &cpuset);
+
+ /*
+ * Android doesn't support pthread_setaffinity_np, and glibc doesn't
+ * have a wrapper for gettid(), alternatively we could use
+ * syscall(__NR_gettid) for both...
+ */
+#ifdef ANDROID
+ return sched_setaffinity(gettid(), sizeof(cpuset), &cpuset);
+#else
+ return pthread_setaffinity_np(blp->thread, sizeof(cpuset), &cpuset);
+#endif
+}
+
+static int is_cpu_used(int id)
+{
+ if (ind_switch)
+ return cpu_props[id].used;
+ else
+ return 1;
+}
+
+struct bl_properties *get_cpu_props(void)
+{
+ if (!cpu_props) {
+ printf("error cpu_props is null\n");
+ return NULL;
+ }
+
+ return cpu_props;
+}
+
+/* big.LITTLE sysfs functions */
+
+static int bl_prepare_info(struct bl_properties *blp)
+{
+ char line[MAX_LINE];
+ int i;
+ int err;
+ int cpu_max = count_cpus();
+
+ cpu_props = malloc(sizeof(*cpu_props) * cpu_max);
+ if (!cpu_props)
+ return -ENOMEM;
+
+ memset(cpu_props, 0, sizeof(*cpu_props) * cpu_max);
+
+ printf("***bl-agitator***\nCPU count: %d\n", cpu_max);
+ for (i = 0; i < cpu_max; i++) {
+ cpu_props[i].cpu_max = cpu_max;
+ cpu_props[i].cpuid = i;
+
+ /* Get _big_ frequency */
+ err = sysfs_read_file(0, "cpuinfo_max_freq", line, sizeof(line));
+ if (err < 0)
+ goto err;
+ cpu_props[i].big_freq = strtoul(line, NULL, 0);
+
+ /* Get _LITTLE_ frequency */
+ err = sysfs_read_file(0, "cpuinfo_min_freq", line, sizeof(line));
+ if (err < 0)
+ goto err;
+ cpu_props[i].little_freq = strtoul(line, NULL, 0);
+
+ printf("CPU%d: big freq %lu LITTLE freq %lu\n",
+ i, cpu_props[i].big_freq, cpu_props[i].little_freq);
+ }
+
+ return 0;
+
+err:
+ free(cpu_props);
+ return err;
+}
+
+static int bl_check_cpu_state(struct bl_properties blp)
+{
+ char line[MAX_LINE];
+ unsigned long curr_freq;
+ int err;
+
+ err = sysfs_read_file(blp.cpuid, "cpuinfo_cur_freq", line, sizeof(line));
+ curr_freq = strtoul(line, NULL, 0);
+ printf("cpu%d cpuinfo_cur_freq %lu [%s]\n",
+ blp.cpuid, curr_freq, _bl_name(blp, curr_freq));
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+
+static int bl_set_frequency(struct bl_properties blp, char *frequency)
+{
+ char line[MAX_LINE], curr[MAX_LINE];
+ unsigned long target_freq, curr_freq;
+ int err;
+
+ if (strcmp("big", frequency) == 0) {
+ target_freq = blp.big_freq;
+ snprintf(line, MAX_LINE, "%lu", blp.big_freq);
+ } else if(strcmp("little", frequency) == 0) {
+ target_freq = blp.little_freq;
+ snprintf(line, MAX_LINE, "%lu", blp.little_freq);
+ } else {
+ printf("unknown target frequency\n");
+ return -EINVAL;
+ }
+
+ sysfs_write_file(blp.cpuid, "scaling_setspeed", line, sizeof(line));
+ /* DONE: consider cpuinfo_transition_latency before checking */
+ usleep(50000);
+ sysfs_read_file(blp.cpuid, "cpuinfo_cur_freq", curr, sizeof(curr));
+ curr_freq = strtoul(curr, NULL, 0);
+
+ err = curr_freq == target_freq ? 0 : 1;
+ dbg(err, "cpu%d scaling_setspeed target %lu current %lu... %s\n",
+ blp.cpuid, target_freq, curr_freq, !err ? "OK" : "FAIL");
+
+ if (err)
+ return -EIO;
+
+ return 0;
+}
+
+static int bl_set_governor(struct bl_properties blp, char *governor)
+{
+ char line[MAX_LINE], curr[MAX_LINE];
+ int len, err;
+
+ len = strlen(governor);
+ if (len > 20)
+ return -EINVAL;
+ strncpy(line, governor, len + 1);
+
+ sysfs_write_file(blp.cpuid, "scaling_governor", line, 20);
+ sysfs_read_file(blp.cpuid, "scaling_governor", curr, 20);
+ err = strncmp(line, curr, len) || curr[len] != '\n';
+ dbg(err, "cpu%d scaling_governor set to %s ... %s\n",
+ blp.cpuid, line, !err ? "OK" : "FAIL");
+
+ if (err)
+ return -EIO;
+
+ return 0;
+}
+
+static int _bl_single_cpu_switch(struct bl_properties blp, unsigned long time)
+{
+ if (bl_set_frequency(blp, "big"))
+ return -EIO;
+ usleep(time * 1000);
+
+ if (sync_transition)
+ thread_transition_barrier();
+
+ if (bl_set_frequency(blp, "little"))
+ return -EIO;
+ usleep(time * 1000);
+
+ if (sync_transition)
+ thread_transition_barrier();
+
+ return 0;
+}
+
+static int _bl_multi_cpu_switch(unsigned long time)
+{
+ struct bl_properties *props = get_cpu_props();
+ int cpu_max = props->cpu_max;
+ int i;
+
+ for (i = 0; i < cpu_max; i++) {
+ if (!is_cpu_used(i))
+ continue;
+
+ if (bl_set_frequency(props[i], "big"))
+ return -EIO;
+ usleep(time * 1000);
+ }
+
+ for (i = 0; i < cpu_max; i++) {
+ if (!is_cpu_used(i))
+ continue;
+
+ if (bl_set_frequency(props[i], "little"))
+ return -EIO;
+ usleep(time * 1000);
+ }
+
+ return 0;
+}
+
+static int _bl_periodic_switch(struct bl_properties blp, char *switch_period)
+{
+ unsigned long time;
+ unsigned long iter = 0;
+ int err;
+
+ time = strtoul(switch_period, NULL, 0);
+ if (!time)
+ return -EINVAL;
+
+ printf("Periodic switcher time %lu\n", time);
+
+ if (threaded) {
+ err = bl_set_governor(blp, "userspace");
+ if (err)
+ return err;
+
+ while (1) {
+ if (_bl_single_cpu_switch(blp, time)) {
+ dbg(1, "error on iteration %lu period %lu\n", iter, time);
+ return -EIO;
+ }
+ iter++;
+ }
+ } else {
+ struct bl_properties *props = get_cpu_props();
+ int cpu_max = props->cpu_max;
+ int i;
+
+ for (i = 0; i < cpu_max; i++) {
+ if (!is_cpu_used(i))
+ continue;
+
+ err = bl_set_governor(props[i], "userspace");
+ if (err)
+ return err;
+ }
+
+ while (1) {
+ if (_bl_multi_cpu_switch(time)) {
+ dbg(1, "error on iteration %lu period %lu\n", iter, time);
+ return -EIO;
+ }
+ iter++;
+ }
+ }
+
+ return 0;
+}
+
+void *bl_periodic_switch(void *cpu_prop)
+{
+ struct bl_properties *blp = cpu_prop;
+ long err;
+
+ if (threaded) {
+ err = set_affinity(blp);
+ if (err)
+ return (void *)err;
+ }
+
+ err = _bl_periodic_switch(*blp, switch_period);
+
+ return (void *)err;
+}
+
+static int _bl_random_switch(struct bl_properties blp, char *seed, char *limit)
+{
+ unsigned long iter = 0, t, seedn, lim;
+ int err;
+
+ seedn = strtoul(seed, NULL, 0);
+ if (seedn)
+ srand(seedn);
+ else
+ srand(time(NULL));
+
+ if (!limit)
+ lim = DEFAULT_LIMIT;
+ else
+ lim = strtoul(limit, NULL, 0);
+
+ if (!lim || lim > RAND_MAX)
+ lim = RAND_MAX;
+
+ printf("Random switcher seed %lu limit %lu\n", seedn, lim);
+
+ if (threaded) {
+ err = bl_set_governor(blp, "userspace");
+ if (err)
+ return err;
+
+ while (1) {
+ t = (double)rand() / RAND_MAX * (lim - 1) + 1;
+ if (_bl_single_cpu_switch(blp, t)) {
+ dbg(1, "error on iteration %lu period %lu\n", iter, t);
+ return -EIO;
+ }
+ iter++;
+ }
+ } else {
+ struct bl_properties *props = get_cpu_props();
+ int cpu_max = props->cpu_max;
+ int i;
+
+ for (i = 0; i < cpu_max; i++) {
+ if (!is_cpu_used(i))
+ continue;
+
+ err = bl_set_governor(props[i], "userspace");
+ if (err)
+ return err;
+ }
+
+ while (1) {
+ t = (double)rand() / RAND_MAX * (lim - 1) + 1;
+ if (_bl_multi_cpu_switch(t)) {
+ dbg(1, "error on iteration %lu period %lu\n", iter, t);
+ return -EIO;
+ }
+ iter++;
+ }
+ }
+
+ return 0;
+}
+
+void *bl_random_switch(void *cpu_prop)
+{
+ struct bl_properties *blp = cpu_prop;
+ long err;
+
+ if (threaded) {
+ err = set_affinity(blp);
+ if (err)
+ return (void *)err;
+ }
+
+ err = _bl_random_switch(*blp, seed, limit);
+
+ return (void *)err;
+}
+
+void print_elapsed_time()
+{
+ struct timespec end, elapsed;
+ long int msec, sec, min, hour;
+
+ clock_gettime(CLOCK_MONOTONIC, &end);
+
+ elapsed.tv_sec = end.tv_sec - start.tv_sec;
+ elapsed.tv_nsec = end.tv_nsec - start.tv_nsec;
+
+ if (elapsed.tv_nsec < 0) {
+ msec = (1000000000 + end.tv_sec - start.tv_sec) / 1000000;
+ elapsed.tv_sec -= 1;
+ } else {
+ msec = elapsed.tv_nsec / 1000000;
+ }
+
+ hour = elapsed.tv_sec / 3600;
+ min = (elapsed.tv_sec % 3600) / 60;
+ sec = elapsed.tv_sec % 60;
+
+ printf("Time elapsed: %ld:%02ld:%02ld.%03ld\n", hour, min, sec, msec);
+}
+
+void sigaction_handler(int sig)
+{
+ print_elapsed_time();
+ dbg(1, "Terminated because of SIG %d\n", sig);
+ exit(0);
+}
+
+static struct option long_opts[] = {
+ {"cpu", required_argument, 0, 'c'},
+ {"freq", required_argument, 0, 'f'},
+ {"governor", required_argument, 0, 'g'},
+ {"info", no_argument, 0, 'i'},
+ {"switch", required_argument, 0, 's'},
+ {"rand", required_argument, 0, 'r'},
+ {"limit", required_argument, 0, 'l'},
+ {"thread", no_argument, 0, 'n'},
+ {"sync-thread", no_argument, 0, 'S'},
+ {"verbose", no_argument, 0, 'v'},
+ {0, 0, 0, 0 }
+};
+
+void usage()
+{
+ printf("usage: ./bl-agitator [-v] [-i] [-f <big|little>] [-g <governor>] [-s <msecs>]\n");
+ printf("Options:\n");
+ printf(" -i, --info\t\t\tCheck which cluster is running [big|little]\n");
+ printf(" -c --cpu <num>\t\tOperate on this cpu, this option can be specified multiple times\n");
+ printf(" -f, --freq\t\t\tSet a cluster to the desired frequency\n");
+ printf(" -g, --governor <governor>\tChange to desired governor\n");
+ printf(" -s, --switch <time>\t\tbig.LITTLE switching using 'time' as interval (in msecs)\n");
+ printf(" -r, --rand <seed>\t\tRandom seed for periodic time switch, 0 will use time()\n");
+ printf(" -l, --limit <num>\t\tInterval limit for random number generation\n");
+ printf(" -n --thread\t\t\tSet threaded mode for random or periodic switching\n");
+ printf("\t\tOn threaded mode:\n");
+ printf("\t\t -S, --single-sync\t\t\tSequential half transition (e.g.: big->barrier->little->barrier\n");
+ printf(" -v, --verbose\t\t\tVerbose mode\n");
+ printf(" -h, --help\t\t\tthis help screen\n");
+ exit (1);
+}
+
+static int run_commands()
+{
+ int i, ret;
+ int max_cpu = count_cpus();
+
+ if (info) {
+ for (i = 0; i < max_cpu; i++) {
+ if (!is_cpu_used(i))
+ continue;
+ ret = bl_check_cpu_state(cpu_props[i]);
+ if (ret)
+ return ret;
+ }
+ }
+
+ if (governor) {
+ for (i = 0; i < max_cpu; i++) {
+ if (!is_cpu_used(i))
+ continue;
+
+ ret = bl_set_governor(cpu_props[i], governor);
+ if (ret)
+ return ret;
+ }
+ }
+
+ if (frequency) {
+ for (i = 0; i < max_cpu; i++) {
+ if (!is_cpu_used(i))
+ continue;
+
+ ret = bl_set_frequency(cpu_props[i], frequency);
+ if (ret)
+ return ret;
+ }
+ }
+
+ if (seed) {
+ if (threaded) {
+ for (i = 0; i < max_cpu; i++) {
+ if (!is_cpu_used(i))
+ continue;
+
+ pthread_create(&cpu_props[i].thread, NULL, bl_random_switch, &cpu_props[i]);
+ }
+ } else {
+ /* Cast err_ptr */
+ ret = (long)bl_random_switch(get_cpu_props());
+ if (ret)
+ return ret;
+ }
+ }
+
+ if (switch_period) {
+ if (threaded) {
+ for (i = 0; i < max_cpu; i++) {
+ if (!is_cpu_used(i))
+ continue;
+
+ pthread_create(&cpu_props[i].thread, NULL, bl_periodic_switch, &cpu_props[i]);
+ }
+ } else {
+ /* Cast err_ptr */
+ ret = (long)bl_periodic_switch(get_cpu_props());
+ if (ret)
+ return ret;
+ }
+ }
+
+ if (threaded) {
+ for (i = 0; i < max_cpu; i++) {
+ if (!is_cpu_used(i))
+ continue;
+
+ pthread_join(cpu_props[i].thread, NULL);
+ }
+ }
+
+ return 0;
+}
+
+int main(int argc, char **argv)
+{
+ int c, max_cpu;
+ struct bl_properties blp;
+ struct sigaction sigact;
+
+ memset(&sigact, 0, sizeof(sigact));
+ sigemptyset(&sigact.sa_mask);
+ sigact.sa_flags = 0;
+ sigact.sa_handler = &sigaction_handler;
+
+ sigaction(SIGINT, &sigact, 0);
+ sigaction(SIGTERM, &sigact, 0);
+
+ if (bl_prepare_info(&blp))
+ goto err;
+
+ max_cpu = count_cpus();
+
+ while (1) {
+ int opt_id = 0;
+
+ c = getopt_long(argc, argv, "hic:f:g:s:r:l:nSv", long_opts, &opt_id);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 'i':
+ info = 1;
+ break;
+ case 'c':
+ ind_switch = 1;
+ int cpu = atoi(optarg);
+ if (cpu >= max_cpu || cpu < 0) {
+ dbg(1, "Unknown CPU%d\n", cpu);
+ goto free;
+ }
+ cpu_props[cpu].used = 1;
+ used_cnt++;
+ break;
+ case 'f':
+ frequency = optarg;
+ break;
+ case 'g':
+ governor = optarg;
+ break;
+ case 's':
+ if (seed) {
+ usage();
+ goto free;
+ }
+ switch_period = optarg;
+ break;
+ case 'n':
+ threaded = 1;
+ break;
+ case 'S':
+ sync_transition = 1;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'r':
+ if (switch_period) {
+ usage();
+ goto free;
+ }
+ seed = optarg;
+ break;
+ case 'l':
+ limit = optarg;
+ break;
+ case 'h':
+ default:
+ usage();
+ break;
+ }
+ }
+
+ if (!ind_switch)
+ used_cnt = max_cpu;
+
+ if (threaded && !(seed || switch_period)) {
+ usage();
+ goto free;
+ }
+
+ if (!threaded && sync_transition) {
+ usage();
+ goto free;
+ }
+
+ clock_gettime(CLOCK_MONOTONIC, &start);
+
+ if (run_commands())
+ goto exit;
+
+ print_elapsed_time();
+ exit(0);
+
+exit:
+ print_elapsed_time();
+free:
+ free(cpu_props);
+err:
+ exit(1);
+}
diff --git a/boot-a15/boot-a15.sh b/boot-a15/boot-a15.sh
new file mode 100755
index 0000000..59598f0
--- /dev/null
+++ b/boot-a15/boot-a15.sh
@@ -0,0 +1,143 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Amit Pundir <amit.pundir@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo ""
+ echo "usage: $0 -c <cpu number> [Optional Arguments...]"
+ echo "Options: -c operate on this cpu, this option can be specified multiple times"
+ echo ""
+ echo "Example: $0 -c 0 -c 1 ... -c $large_cpu_number"
+ exit 1
+}
+
+check_kernel_oops()
+{
+ KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+ if [ -n "$KERNEL_ERR" ]; then
+ echo "Kernel OOPS. Abort!!"
+ exit 1
+ fi
+}
+
+insert_bl_module()
+{
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+ if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+ fi
+ fi
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+ if [ -z "$CPU_FREQ_KM" ]; then
+ insmod $MOD_LOCATION
+ fi
+ check_kernel_oops
+}
+
+switch()
+{
+ CUR_FREQ=`cat /sys/devices/system/cpu/cpu"$CPU_NUM"/cpufreq/cpuinfo_cur_freq`
+ if [ -z $CUR_FREQ ]; then
+ echo "Unable to get current operating frequency"
+ exit 1
+ fi
+ if [ "$CUR_FREQ" -eq "$LITTLE" ]; then
+ echo "cpu$CPU_NUM is LITTLE. Switching to big.."
+ bl-agitator -f big -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE switcher failed for cpu$CPU_NUM. Abort!!"
+ exit 1
+ else
+ echo "cpu$CPU_NUM successfully switched to big."
+ fi
+ else if [ "$CUR_FREQ" -eq "$BIG" ]; then
+ echo "cpu$CPU_NUM is big"
+ else if [ "$CUR_FREQ" -gt "$LITTLE" ]; then
+ if [ "$CUR_FREQ" -lt "$BIG" ]; then
+ echo "cpu$CPU_NUM is LITTLE. Switching to big.."
+ bl-agitator -f big -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE switcher failed for cpu$CPU_NUM. Abort!!"
+ exit 1
+ else
+ echo "cpu$CPU_NUM successfully switched to big."
+ fi
+ fi
+ else
+ echo "cpu$CPU_NUM operating at Current Frequency = $CUR_FREQ"
+ exit 1
+ fi
+ fi
+ fi
+}
+
+TOTAL_ACTIVE_CPUS=`ls /sys/devices/system/cpu/cpu*/online | wc -l`
+large_cpu_number=$((TOTAL_ACTIVE_CPUS-1))
+
+if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ echo "Running $0 $1 $2"
+else
+ echo "Error: Specify the number of CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+fi
+
+# insert bl module is intended for RTSM
+MODEL=`cat /proc/device-tree/model`
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ echo "insert bl module from boot-a15.sh"
+ insert_bl_module
+fi
+
+BIG=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+LITTLE=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+
+while [ "$1" ]; do
+ case "$1" in
+ -c|--cpu-num)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ CPU_NUM=$2;
+ switch
+ shift;
+ else
+ usage
+ fi
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+check_kernel_oops
+
+exit 0
diff --git a/boot-a7/boot-a7.sh b/boot-a7/boot-a7.sh
new file mode 100755
index 0000000..f073305
--- /dev/null
+++ b/boot-a7/boot-a7.sh
@@ -0,0 +1,143 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Amit Pundir <amit.pundir@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo ""
+ echo "usage: $0 -c <cpu number> [Optional Arguments...]"
+ echo "Options: -c operate on this cpu, this option can be specified multiple times"
+ echo ""
+ echo "Example: $0 -c 0 -c 1 ... -c $large_cpu_number"
+ exit 1
+}
+
+check_kernel_oops()
+{
+ KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+ if [ -n "$KERNEL_ERR" ]; then
+ echo "Kernel OOPS. Abort!!"
+ exit 1
+ fi
+}
+
+insert_bl_module()
+{
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+ if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+ fi
+ fi
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+ if [ -z "$CPU_FREQ_KM" ]; then
+ insmod $MOD_LOCATION
+ fi
+ check_kernel_oops
+}
+
+switch()
+{
+ CUR_FREQ=`cat /sys/devices/system/cpu/cpu"$CPU_NUM"/cpufreq/cpuinfo_cur_freq`
+ if [ -z $CUR_FREQ ]; then
+ echo "Unable to get current operating frequency"
+ exit 1
+ fi
+ if [ "$CUR_FREQ" -eq "$LITTLE" ]; then
+ echo "cpu$CPU_NUM is LITTLE"
+ else if [ "$CUR_FREQ" -eq "$BIG" ]; then
+ echo "cpu$CPU_NUM is big. Switching to LITTLE.."
+ bl-agitator -f little -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE switcher failed for cpu$CPU_NUM. Abort!!"
+ exit 1
+ else
+ echo "cpu$CPU_NUM successfully switched to LITTLE."
+ fi
+ else if [ "$CUR_FREQ" -lt "$BIG" ]; then
+ if [ "$CUR_FREQ" -gt "$LITTLE" ]; then
+ echo "cpu$CPU_NUM is big. Switching to LITTLE.."
+ bl-agitator -f little -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE switcher failed for cpu$CPU_NUM. Abort!!"
+ exit 1
+ else
+ echo "cpu$CPU_NUM successfully switched to LITTLE."
+ fi
+ fi
+ else
+ echo "cpu$CPU_NUM operating at Current Frequency = $CUR_FREQ"
+ exit 1
+ fi
+ fi
+ fi
+}
+
+TOTAL_ACTIVE_CPUS=`ls /sys/devices/system/cpu/cpu*/online | wc -l`
+large_cpu_number=$((TOTAL_ACTIVE_CPUS-1))
+
+if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ echo "Running $0 $1 $2"
+else
+ echo "Error: Specify the number of CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+fi
+
+# insert bl module is intended for RTSM
+MODEL=`cat /proc/device-tree/model`
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ echo "insert bl module from boot-a7.sh"
+ insert_bl_module
+fi
+
+BIG=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+LITTLE=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+
+while [ "$1" ]; do
+ case "$1" in
+ -c|--cpu-num)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ CPU_NUM=$2;
+ switch
+ shift;
+ else
+ usage
+ fi
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+check_kernel_oops
+
+exit 0
diff --git a/cache-coherency-switcher/cache-coherency-switcher.sh b/cache-coherency-switcher/cache-coherency-switcher.sh
new file mode 100755
index 0000000..4a904e3
--- /dev/null
+++ b/cache-coherency-switcher/cache-coherency-switcher.sh
@@ -0,0 +1,472 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Avik Sil <avik.sil@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo ""
+ echo "usage: $0 [<option> <argument>] .."
+ echo ""
+ echo "Options: -f <operating frequency> [big/little; Default: big]"
+ echo " -c <operate on this cpu> [this option can be specified multiple times]"
+ echo " -d <take this cpu offline>"
+ echo " -e <bring this cpu online>"
+ echo " -t <number of seconds> [Default: 10]"
+ echo " -m <amount of memory> [Default: 16M]"
+ echo " -s <periodic switching interval in msec> [Default: 50]"
+ echo " -r <random switching seed> [Default: 100]"
+ echo " -l <random switching seed limit> [Default: 1000]"
+ echo " -n <threads to be executed on specific cpus>"
+ echo " -S single-sync Sequential half transition (e.g.: big->barrier->little->barrier)"
+ echo ""
+ echo "Example of periodic switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -s 50"
+ echo "Example of random switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -r 100 -l 1000"
+ echo "Example of periodic switching while spawning threads on cpu0 and cpu3: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -n 0 ... $large_cpu_number -s 50"
+ echo "Example of simultaneous thread while spawning threads on all cpus: $0 -f big -c 0 -n 0 ... $large_cpu_number -s 100 -S"
+ exit 1
+}
+
+CC_STATUS=0;
+SWITCHER_STATUS=0;
+
+total_no_of_cpu=`ls /sys/devices/system/cpu/cpu*/online | wc -l`
+large_cpu_number=$((total_no_of_cpu-1))
+
+TASKSET=affinity_tools
+
+CPU_FAST=
+CPU_SLOW=
+
+#ARM
+IMPLEMENTER=0x41
+#A7
+PART_SLOW=0xc07
+#A15
+PART_FAST=0xc0f
+eachslow=
+eachfast=
+EACH_CPU=
+
+get_no_of_cpus ()
+{
+ cpu=0
+ while [ $cpu -lt $total_no_of_cpu ];
+ do
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_SLOW >/dev/null
+ if [ $? == 0 ] ; then
+ eachslow=" -c "
+ CPU_SLOW=$CPU_SLOW$eachslow$cpu
+ fi
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_FAST >/dev/null
+ if [ $? == 0 ] ; then
+ eachfast=" -c "
+ CPU_FAST=$CPU_FAST$eachfast$cpu
+ fi
+ cpu=$((cpu+1))
+ done
+ EACH_CPU="$CPU_SLOW$CPU_FAST"
+}
+
+switch()
+{
+ if [ "$FREQ" -eq 0 ]; then
+ boot_a15
+ else if [ "$FREQ" -eq 1 ]; then
+ boot_a7
+ else
+ echo "Error: Unknown Operating frequency. Has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+}
+
+boot_a15()
+{
+ echo ""
+ echo "Switching to big mode if not already in."
+ boot-a15.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a15 failed. Abort!!"
+ exit 1
+ fi
+}
+
+boot_a7()
+{
+ echo ""
+ echo "Switching to little mode if not already in."
+ echo " boot-a7.sh -c $CPU_NUM "
+ boot-a7.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a7 failed. Abort!!"
+ exit 1
+ fi
+}
+
+disable_cpu()
+{
+ echo ""
+ echo "Taking CPU$DISABLE_CPU offline .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$DISABLE_CPU/online`
+ if [ $STATUS -eq 1 ]; then
+ echo 0 > /sys/devices/system/cpu/cpu$DISABLE_CPU/online
+ else
+ echo "CPU$DISABLE_CPU already in offline mode."
+ fi
+}
+
+enable_cpu()
+{
+ echo ""
+ echo "Bringing CPU$ENABLE_CPU online .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$ENABLE_CPU/online`
+ if [ $STATUS -eq 0 ]; then
+ echo 1 > /sys/devices/system/cpu/cpu$ENABLE_CPU/online
+ else
+ echo "CPU$ENABLE_CPU already in online mode."
+ fi
+}
+
+run_cache_coherency()
+{
+ # Set defaults for stressapptest's cache coherency test
+ if [ -z "$MEM" ]; then
+ MEM=16;
+ fi
+ if [ -z "$SEC" ]; then
+ SEC=10;
+ fi
+
+ echo ""
+ echo "Running stressapptest -M $MEM --cc_test -s $SEC"
+ CC_ERROR=`stressapptest -M $MEM --cc_test -s $SEC | grep "miscompare"`
+ if [ -n "$CC_ERROR" ]; then
+ echo "CC_ERROR: $CC_ERROR"
+ echo "cache-coherency test failed. Abort!!"
+ CC_STATUS=1;
+ return 1
+ else
+ echo "cache-coherency test finished successfully"
+ return 0
+ fi
+}
+
+run_periodic_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE periodic switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR &"
+ bl-agitator -n $EACH_CPU -s $INTR &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE periodic switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+run_random_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE random switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &"
+ bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE random switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+simultaneous_thread_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE simultaneous thread switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR -S &"
+ bl-agitator -n $EACH_CPU -s $INTR -S &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE simultaneous thread switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+kill_switcher()
+{
+ echo ""
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ echo "Kill bigLITTLE switcher BL_AGITATOR_PID $BL_AGITATOR_PID"
+ echo "PID_BL_CHECK= $PID_BL_CHECK"
+
+ if [ -z "$PID_BL_CHECK" ]; then
+ echo "bigLITTLE switcher not running. Report Error!!"
+ exit 1
+ else
+ # done with bl-agitator. Kill the process
+ echo "sending SIGTERM BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill $BL_AGITATOR_PID
+
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ if [ -n "$PID_BL_CHECK_AGAIN" ]; then
+ #if the above kill is not successfull. kill forcefully
+ echo "sending SIGKILL BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill -9 $BL_AGITATOR_PID > /dev/null 2>&1
+ fi
+ fi
+}
+
+if [ -z "$1" ]; then
+ usage
+fi
+
+get_no_of_cpus
+
+while [ "$1" ]; do
+ case "$1" in
+ -f|--frequency)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ if [ "$2" = "big" ]; then
+ FREQ=0;
+ shift;
+ else if [ "$2" = "little" ]; then
+ FREQ=1;
+ shift;
+ else
+ echo "Error: Operating frequency has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+ ;;
+ -c|--cpu-num)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ CPU_NUM=$2;
+ if [ -z "$FREQ" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ switch
+ shift;
+ else
+ usage
+ fi
+ ;;
+ -d|--disable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ DISABLE_CPU=$2;
+ disable_cpu
+ shift;
+ fi
+ ;;
+ -e|--enable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ ENABLE_CPU=$2;
+ enable_cpu
+ shift;
+ fi
+ ;;
+ -t|--seconds)
+ if [ "$2" -gt 0 ]; then
+ SEC=$2;
+ shift;
+ fi
+ ;;
+ -m|--memory)
+ if [ "$2" -gt 0 ]; then
+ MEM=$2;
+ shift;
+ fi
+ ;;
+ -s|--periodic-switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ PERIODIC_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ INTR=$2;
+ else
+ INTR=50;
+ fi
+ else
+ echo "Invalid option (-s) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Random switching mode"
+ fi
+ shift;
+ ;;
+ -r|--random-switching)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ RANDOM_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ SEED=$2;
+ else
+ SEED=100;
+ fi
+ else
+ echo "Invalid option (-r) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -l|--seed-limit)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ if [ -z "$SEED" ]; then
+ echo "Error: Specify the Seed for the random switcher [-r 100]"
+ usage
+ fi
+ if [ "$2" -gt 0 ]; then
+ LIMIT=$2;
+ else
+ LIMIT=1000;
+ fi
+ else
+ echo "Invalid option (-l) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -n|--thread-switching)
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU0=$2;
+ shift;
+ else
+ echo "Error: Must specify at least one CPU on which thread has to be spawned"
+ usage
+ fi
+ shift;
+ ;;
+ -S|--simultaneous_thread_switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ SIMULTANEOUS_THREAD_SWITCH=y;
+ else
+ echo "Invalid option (-S) !!"
+ echo "Can't do random and simultaneous thread switching at a time"
+ echo "Set to Random switching mode"
+ fi
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+if [ -z "$FREQ" ]; then
+ echo "Error: Frequency has to be set to either \"big\" or \"little\""
+ usage
+else if [ -z "$CPU_NUM" ]; then
+ echo "Error: Specify the number of CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+fi
+fi
+
+if [ "$PERIODIC_SWITCH" = "y" ]; then
+ if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ echo ""
+ else
+ run_periodic_switcher
+ fi
+fi
+
+if [ "$RANDOM_SWITCH" = "y" ]; then
+ if [ -z "$LIMIT" ]; then
+ echo "Error: Specify the Seed Limit for the random switcher [-l 1000]"
+ usage
+ fi
+ run_random_switcher
+fi
+
+if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ simultaneous_thread_switcher
+ cluster-status.sh $BL_AGITATOR_PID &
+fi
+
+run_cache_coherency
+
+if ([ "$PERIODIC_SWITCH" = "y" ] || [ "$RANDOM_SWITCH" = "y" ] || [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]); then
+ kill_switcher
+fi
+
+if ([ $CC_STATUS -ne 0 ] || [ $SWITCHER_STATUS -ne 0 ]); then
+ echo "Test failed. Abort!!"
+ exit 1
+fi
+
+KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+if [ -n "$KERNEL_ERR" ]; then
+ echo "Kernel OOPS detected. Abort!!"
+ exit 1
+fi
+
+exit 0
diff --git a/cluster-status/cluster-status.sh b/cluster-status/cluster-status.sh
new file mode 100755
index 0000000..9c138e2
--- /dev/null
+++ b/cluster-status/cluster-status.sh
@@ -0,0 +1,91 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+# bl-agitator is able to switch tasks from one cluster to other cluster
+# at a time. we have to have validate it by reading the cluster status
+# registers 0x6000000c and 0x60000010 of cluster_0 and cluster_1.
+# Here we are using devmem tool/binary to read these locations.
+
+#bl-agitator pid
+PID=$1
+
+CLUSTER_0=0
+CLUSTER_1=0
+
+get_no_of_cpu()
+{
+ TOTAL_ACTIVE_CPUS=`cat /proc/cpuinfo | grep processor | wc -l`
+ if [ $TOTAL_ACTIVE_CPUS -eq 2 ]; then
+ CLUSTER_0_ADDR=0x7fff0018
+ CLUSTER_1_ADDR=0x7fff0018
+ else if [ $TOTAL_ACTIVE_CPUS -eq 4 ]; then
+ CLUSTER_0_ADDR=0x6000000c
+ CLUSTER_1_ADDR=0x60000010
+ else
+ echo " unknown architecture"
+ exit 1
+ fi
+ fi
+}
+
+get_no_of_cpu
+
+if [ -x /usr/bin/devmem ]
+then
+ DEVMEM="/usr/bin/devmem"
+elif [ -x /bin/busybox ]
+then
+ DEVMEM="/bin/busybox devmem"
+elif [ -x /system/bin/devmem ]
+then
+ DEVMEM="/system/bin/devmem"
+else
+ echo "ERROR: devmem binary not found"
+ exit 1
+fi
+
+while kill -0 $PID ; do
+# loop until bl-agitator is alive
+ echo ""
+ CLUSTER_0=`$DEVMEM $CLUSTER_0_ADDR`
+ echo "CLUSTER_0 = $CLUSTER_0"
+ if [ "$CLUSTER_0" = "0x5FFFF000" ]; then
+ echo "CLUSTER_0 is shutdown"
+ else
+ echo "CLUSTER_0 is running"
+ fi
+
+ CLUSTER_1=`$DEVMEM $CLUSTER_1_ADDR`
+ echo "CLUSTER_1 = $CLUSTER_1"
+ if [ "$CLUSTER_1" = "0x40001FFF" ]; then
+ echo "CLUSTER_1 is shutdown"
+ else
+ echo "CLUSTER_1 is running"
+ fi
+
+ if ([ "$CLUSTER_1" = "0x40001FFF" ] || [ "$CLUSTER_0" = "0x5FFFF000" ]); then
+ # do nothing
+ echo -ne ""
+ else
+ echo " Test failed !!!"
+ exit 1
+ fi
+
+ sleep 1
+done
diff --git a/cpu_freq_vs_cluster_freq/cpu_freq_cope_on_cluster_freq.sh b/cpu_freq_vs_cluster_freq/cpu_freq_cope_on_cluster_freq.sh
new file mode 100755
index 0000000..ed95830
--- /dev/null
+++ b/cpu_freq_vs_cluster_freq/cpu_freq_cope_on_cluster_freq.sh
@@ -0,0 +1,65 @@
+# Copyright (C) 2013, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+# Modified-by: Nicolas Pitre <nicolas.pitre@linaro.org>
+#
+
+GOVERNOR=userspace
+# set userspace governor
+set_governor()
+{
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+ do echo $GOVERNOR > $file
+ done
+ sleep 1
+}
+# set lowest frequency everywhere
+set_lowest_freq()
+{
+ for cpufreq in /sys/devices/system/cpu/cpu*/cpufreq
+ do cat $cpufreq/scaling_min_freq > $cpufreq/scaling_setspeed
+ done
+}
+
+# now cycle each CPU in turn and see the effect on others
+cycle_all_cpus()
+{
+ for cpu in /sys/devices/system/cpu/cpu*/
+ do if [ -f $cpu/cpufreq/cpuinfo_cur_freq ]
+ then orig_freq=$(cat $cpu/cpufreq/cpuinfo_cur_freq)
+ for freq in $(cat $cpu/cpufreq/scaling_available_frequencies)
+ do echo $freq > $cpu/cpufreq/scaling_setspeed
+ usleep 500000
+ echo -ne "$(basename $cpu)=$freq:"
+ dump_current_cpu_freqs
+ done
+ echo $orig_freq > $cpu/cpufreq/scaling_setspeed
+ fi
+ done
+}
+
+dump_current_cpu_freqs()
+{
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do echo -ne "\t$(cat $file)"
+ done
+ echo
+}
+
+set_governor
+set_lowest_freq
+cycle_all_cpus
diff --git a/cpu_freq_vs_cluster_freq/cpu_freq_vs_cluster_freq.sh b/cpu_freq_vs_cluster_freq/cpu_freq_vs_cluster_freq.sh
new file mode 100755
index 0000000..3b68bb0
--- /dev/null
+++ b/cpu_freq_vs_cluster_freq/cpu_freq_vs_cluster_freq.sh
@@ -0,0 +1,79 @@
+# Copyright (C) 2013, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+if [ -z "$FILE" ]; then
+ if [ -r /data/boxes/cpu_freq_cope_on_cluster_freq_output_org.log ]; then
+ ORIGINAL_FILE=/data/boxes/cpu_freq_cope_on_cluster_freq_output_org.log;
+ CURRENT_FILE=/data/boxes/cpu_freq_cope_on_cluster_freq_output.log;
+ elif [ -r /usr/share/testdata/cpu_freq_cope_on_cluster_freq_output_org.log ]; then
+ ORIGINAL_FILE=/usr/share/testdata/cpu_freq_cope_on_cluster_freq_output_org.log;
+ CURRENT_FILE=/usr/share/testdata/cpu_freq_cope_on_cluster_freq_output.log;
+ fi
+fi
+
+enable_switcher()
+{
+ echo 1 > /sys/kernel/bL_switcher/active
+}
+
+disable_switcher()
+{
+ echo 0 > /sys/kernel/bL_switcher/active
+}
+
+disable_switcher
+
+cpu_freq_cope_on_cluster_freq.sh > $CURRENT_FILE
+ERR_CODE=$?
+if [ "$ERR_CODE" -ne 0 ] ; then
+ echo "cpufreq_cope_on_cluster_freq.sh FAILED !!"
+ enable_switcher
+ sleep 10
+ exit 1
+else
+ sleep 10
+fi
+
+diff $ORIGINAL_FILE $CURRENT_FILE > /dev/null 2>&1
+# This test case is design to run on TC2 and specific cpu order and
+# set of cpu freq and this test case is not testing big.LITTLE IKS patches
+# Instead it test cpu freq driver stability and cpu freq change effect on
+# sibling cpus which belongs to a cluster.
+# So making this test case as always pass.
+# This test case could fail if test found any kernel oops
+ERR_CODE=0
+
+ERR_CODE=$?
+if [ "$ERR_CODE" -ne 0 ] ; then
+ echo "cpufreq_cope_on_cluster_freq.sh FAILED !!"
+ enable_switcher
+ sleep 10
+ exit 1
+else
+ enable_switcher
+ sleep 10
+fi
+
+KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+if ([ -n "$KERNEL_ERR" ]); then
+ echo "Kernel OOPS detected. Abort!!"
+ exit 1
+fi
+
+exit 0
diff --git a/cpu_freq_vs_cluster_freq/inputfiles/cpu_freq_cope_on_cluster_freq_output_org.log b/cpu_freq_vs_cluster_freq/inputfiles/cpu_freq_cope_on_cluster_freq_output_org.log
new file mode 100644
index 0000000..b9093b7
--- /dev/null
+++ b/cpu_freq_vs_cluster_freq/inputfiles/cpu_freq_cope_on_cluster_freq_output_org.log
@@ -0,0 +1,40 @@
+cpu0=350000: 350000 350000 350000 500000 500000
+cpu0=400000: 400000 400000 400000 500000 500000
+cpu0=500000: 500000 500000 500000 500000 500000
+cpu0=600000: 600000 600000 600000 500000 500000
+cpu0=700000: 700000 700000 700000 500000 500000
+cpu0=800000: 800000 800000 800000 500000 500000
+cpu0=900000: 900000 900000 900000 500000 500000
+cpu0=1000000: 1000000 1000000 1000000 500000 500000
+cpu1=350000: 350000 350000 350000 500000 500000
+cpu1=400000: 400000 400000 400000 500000 500000
+cpu1=500000: 500000 500000 500000 500000 500000
+cpu1=600000: 600000 600000 600000 500000 500000
+cpu1=700000: 700000 700000 700000 500000 500000
+cpu1=800000: 800000 800000 800000 500000 500000
+cpu1=900000: 900000 900000 900000 500000 500000
+cpu1=1000000: 1000000 1000000 1000000 500000 500000
+cpu2=350000: 350000 350000 350000 500000 500000
+cpu2=400000: 400000 400000 400000 500000 500000
+cpu2=500000: 500000 500000 500000 500000 500000
+cpu2=600000: 600000 600000 600000 500000 500000
+cpu2=700000: 700000 700000 700000 500000 500000
+cpu2=800000: 800000 800000 800000 500000 500000
+cpu2=900000: 900000 900000 900000 500000 500000
+cpu2=1000000: 1000000 1000000 1000000 500000 500000
+cpu3=500000: 350000 350000 350000 500000 500000
+cpu3=600000: 350000 350000 350000 600000 600000
+cpu3=700000: 350000 350000 350000 700000 700000
+cpu3=800000: 350000 350000 350000 800000 800000
+cpu3=900000: 350000 350000 350000 900000 900000
+cpu3=1000000: 350000 350000 350000 1000000 1000000
+cpu3=1100000: 350000 350000 350000 1100000 1100000
+cpu3=1200000: 350000 350000 350000 1200000 1200000
+cpu4=500000: 350000 350000 350000 500000 500000
+cpu4=600000: 350000 350000 350000 600000 600000
+cpu4=700000: 350000 350000 350000 700000 700000
+cpu4=800000: 350000 350000 350000 800000 800000
+cpu4=900000: 350000 350000 350000 900000 900000
+cpu4=1000000: 350000 350000 350000 1000000 1000000
+cpu4=1100000: 350000 350000 350000 1100000 1100000
+cpu4=1200000: 350000 350000 350000 1200000 1200000
diff --git a/data-corruption-switcher/data-corruption-switcher.sh b/data-corruption-switcher/data-corruption-switcher.sh
new file mode 100755
index 0000000..bb89a20
--- /dev/null
+++ b/data-corruption-switcher/data-corruption-switcher.sh
@@ -0,0 +1,474 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Amit Pundir <amit.pundir@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo ""
+ echo "usage: $0 [<option> <argument>] .."
+ echo ""
+ echo "Options: -f <operating frequency> [big/little; Default: big]"
+ echo " -c <operate on this cpu> [this option can be specified multiple times]"
+ echo " -d <take this cpu offline>"
+ echo " -e <bring this cpu online>"
+ echo " -i <number of iterations> [Default: 1]"
+ echo " -p <input file> [Default: /data/boxes/boxes.ppm]"
+ echo " -s <periodic switching interval in msec> [Default: 50]"
+ echo " -r <random switching seed> [Default: 100]"
+ echo " -l <random switching seed limit> [Default: 1000]"
+ echo " -n <threads to be executed on specific cpus>"
+ echo " -S single-sync Sequential half transition (e.g.: big->barrier->little->barrier)"
+ echo ""
+ echo "Example of periodic switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -s 50"
+ echo "Example of random switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -r 100 -l 1000"
+ echo "Example of periodic switching while spawning threads on cpu0 and cpu3: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -n 0 ... $large_cpu_number -s 50"
+ echo "Example of simultaneous thread while spawning threads on all cpus: $0 -f big -c 0 -n 0 ... $large_cpu_number -s 100 -S"
+ exit 1
+}
+
+DC_STATUS=0;
+SWITCHER_STATUS=0;
+
+total_no_of_cpu=`ls /sys/devices/system/cpu/cpu*/online | wc -l`
+large_cpu_number=$((total_no_of_cpu-1))
+
+TASKSET=affinity_tools
+
+CPU_FAST=
+CPU_SLOW=
+
+#ARM
+IMPLEMENTER=0x41
+#A7
+PART_SLOW=0xc07
+#A15
+PART_FAST=0xc0f
+eachslow=
+eachfast=
+EACH_CPU=
+
+get_no_of_cpus ()
+{
+ cpu=0
+ while [ $cpu -lt $total_no_of_cpu ];
+ do
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_SLOW >/dev/null
+ if [ $? == 0 ] ; then
+ eachslow=" -c "
+ CPU_SLOW=$CPU_SLOW$eachslow$cpu
+ fi
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_FAST >/dev/null
+ if [ $? == 0 ] ; then
+ eachfast=" -c "
+ CPU_FAST=$CPU_FAST$eachfast$cpu
+ fi
+ cpu=$((cpu+1))
+ done
+ EACH_CPU="$CPU_SLOW$CPU_FAST"
+}
+
+switch()
+{
+ if [ "$FREQ" -eq 0 ]; then
+ boot_a15
+ else if [ "$FREQ" -eq 1 ]; then
+ boot_a7
+ else
+ echo "Error: Unknown Operating frequency. Has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+}
+
+boot_a15()
+{
+ echo ""
+ echo "Switching to big mode if not already in."
+ boot-a15.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a15 failed. Abort!!"
+ exit 1
+ fi
+}
+
+boot_a7()
+{
+ echo ""
+ echo "Switching to little mode if not already in."
+ boot-a7.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a7 failed. Abort!!"
+ exit 1
+ fi
+}
+
+disable_cpu()
+{
+ echo ""
+ echo "Taking CPU$DISABLE_CPU offline .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$DISABLE_CPU/online`
+ if [ $STATUS -eq 1 ]; then
+ echo 0 > /sys/devices/system/cpu/cpu$DISABLE_CPU/online
+ else
+ echo "CPU$DISABLE_CPU already in offline mode."
+ fi
+}
+
+enable_cpu()
+{
+ echo ""
+ echo "Bringing CPU$ENABLE_CPU online .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$ENABLE_CPU/online`
+ if [ $STATUS -eq 0 ]; then
+ echo 1 > /sys/devices/system/cpu/cpu$ENABLE_CPU/online
+ else
+ echo "CPU$ENABLE_CPU already in online mode."
+ fi
+}
+
+run_data_corruption()
+{
+ # Set defaults for data-crorruption.sh
+ if [ -z "$FILE" ]; then
+ if [ -r /data/boxes/boxes.ppm ]; then
+ FILE=/data/boxes/boxes.ppm;
+ elif [ -r /usr/share/testdata/boxes.ppm ]; then
+ FILE=/usr/share/testdata/boxes.ppm;
+ fi
+ fi
+ if [ -z "$ITR" ]; then
+ ITR=1;
+ fi
+
+ echo ""
+ echo "Running data-corruption.sh "$FILE" "$ITR""
+ data-corruption.sh $FILE $ITR
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "data-corruption.sh failed. Abort!!"
+ DC_STATUS=$ERR_CODE;
+ return 1
+ else
+ echo "data-corruption.sh finished successfully"
+ return 0
+ fi
+}
+
+run_periodic_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE periodic switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR &"
+ bl-agitator -n $EACH_CPU -s $INTR &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE periodic switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+run_random_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE random switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &"
+ bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE random switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+simultaneous_thread_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE simultaneous thread switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR -S &"
+ bl-agitator -n $EACH_CPU -s $INTR -S &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE simultaneous thread switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+kill_switcher()
+{
+ echo ""
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ echo "Kill bigLITTLE switcher BL_AGITATOR_PID $BL_AGITATOR_PID"
+ echo "PID_BL_CHECK= $PID_BL_CHECK"
+
+ if [ -z "$PID_BL_CHECK" ]; then
+ echo "bigLITTLE switcher not running. Report Error!!"
+ exit 1
+ else
+ # done with bl-agitator. Kill the process
+ echo "sending SIGTERM BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill $BL_AGITATOR_PID
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ if [ -n "$PID_BL_CHECK_AGAIN" ]; then
+ #if the above kill is not successfull. kill forcefully
+ echo "sending SIGKILL BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill -9 $BL_AGITATOR_PID > /dev/null 2>&1
+ fi
+ fi
+}
+
+if [ -z "$1" ]; then
+ usage
+fi
+
+get_no_of_cpus
+
+while [ "$1" ]; do
+ case "$1" in
+ -f|--frequency)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ if [ "$2" = "big" ]; then
+ FREQ=0;
+ shift;
+ else if [ "$2" = "little" ]; then
+ FREQ=1;
+ shift;
+ else
+ echo "Error: Operating frequency has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+ ;;
+ -c|--cpu-num)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ CPU_NUM=$2;
+ if [ -z "$FREQ" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ switch
+ shift;
+ else
+ usage
+ fi
+ ;;
+ -d|--disable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ DISABLE_CPU=$2;
+ disable_cpu
+ shift;
+ fi
+ ;;
+ -e|--enable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ ENABLE_CPU=$2;
+ enable_cpu
+ shift;
+ fi
+ ;;
+ -i|--iterations)
+ if [ "$2" -gt 0 ]; then
+ ITR=$2;
+ shift;
+ fi
+ ;;
+ -p|--input-file)
+ if [ -e "$2" ]; then
+ FILE=$2;
+ shift;
+ fi
+ ;;
+ -s|--periodic-switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ PERIODIC_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ INTR=$2;
+ else
+ INTR=50;
+ fi
+ else
+ echo "Invalid option (-s) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Random switching mode"
+ fi
+ shift;
+ ;;
+ -r|--random-switching)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ RANDOM_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ SEED=$2;
+ else
+ SEED=100;
+ fi
+ else
+ echo "Invalid option (-r) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -l|--seed-limit)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ if [ -z "$SEED" ]; then
+ echo "Error: Specify the Seed for the random switcher [-r 100]"
+ usage
+ fi
+ if [ "$2" -gt 0 ]; then
+ LIMIT=$2;
+ else
+ LIMIT=1000;
+ fi
+ else
+ echo "Invalid option (-l) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -n|--thread-switching)
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU0="-c $2";
+ shift;
+ else
+ echo "Error: Must specify at least one CPU on which thread has to be spawned"
+ usage
+ fi
+ shift;
+ ;;
+ -S|--simultaneous_thread_switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ SIMULTANEOUS_THREAD_SWITCH=y;
+ else
+ echo "Invalid option (-S) !!"
+ echo "Can't do random and simultaneous thread switching at a time"
+ echo "Set to Random switching mode"
+ fi
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+if [ -z "$FREQ" ]; then
+ echo "Error: Frequency has to be set to either \"big\" or \"little\""
+ usage
+else if [ -z "$CPU_NUM" ]; then
+ echo "Error: Specify the number of CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+fi
+fi
+
+if [ "$PERIODIC_SWITCH" = "y" ]; then
+ if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ echo ""
+ else
+ run_periodic_switcher
+ fi
+fi
+
+if [ "$RANDOM_SWITCH" = "y" ]; then
+ if [ -z "$LIMIT" ]; then
+ echo "Error: Specify the Seed Limit for the random switcher [-l 1000]"
+ usage
+ fi
+ run_random_switcher
+fi
+
+if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ simultaneous_thread_switcher
+ cluster-status.sh $BL_AGITATOR_PID &
+fi
+
+run_data_corruption
+
+if ([ "$PERIODIC_SWITCH" = "y" ] || [ "$RANDOM_SWITCH" = "y" ] || [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]); then
+ kill_switcher
+fi
+
+if ([ $DC_STATUS -ne 0 ] || [ $SWITCHER_STATUS -ne 0 ]); then
+ echo "Test failed. Abort!!"
+ exit 1
+fi
+
+KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+if [ -n "$KERNEL_ERR" ]; then
+ echo "Kernel OOPS detected. Abort!!"
+ exit 1
+fi
+
+exit 0
diff --git a/data-corruption/data-corruption.sh b/data-corruption/data-corruption.sh
new file mode 100755
index 0000000..74c58f8
--- /dev/null
+++ b/data-corruption/data-corruption.sh
@@ -0,0 +1,109 @@
+#
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Avik Sil <avik.sil@linaro.org>
+
+# Assumes package libjpeg-turbo-progs is installed
+
+set -e
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 <Inputfile (BMP|PPM)> [iterations]"
+ exit 1
+fi
+
+echo
+echo "*** Data Corruption Test ***"
+
+if [ ! -e "$1" ]; then
+ echo "File $1 does not exist!"
+ exit 1
+fi
+
+if [ -n "$2" ]; then
+ if [ $(echo "$2" | grep -E "^[0-9]+$") ]; then
+ iterations=$2
+ else
+ echo "<iterations> must be a valid number; setting it to 1"
+ iterations=1
+ fi
+else
+ iterations=1
+fi
+
+Q=75
+filename=`echo $1 | sed 's/\(.*\)\..*/\1/'`
+suffix_gray="_GRAY_Q$Q.jpg"
+suffix_420="_420_Q$Q.jpg"
+suffix_422="_422_Q$Q.jpg"
+suffix_444="_444_Q$Q.jpg"
+encoded_filename_gray=$filename$suffix_gray
+encoded_filename_420=$filename$suffix_420
+encoded_filename_422=$filename$suffix_422
+encoded_filename_444=$filename$suffix_444
+
+tjbench $1 $Q -rgb -quiet scale 1/2
+MD5SUM_ORIG_GRAY=`md5sum $encoded_filename_gray | cut -f 1 -d ' '`
+MD5SUM_ORIG_420=`md5sum $encoded_filename_420 | cut -f 1 -d ' '`
+MD5SUM_ORIG_422=`md5sum $encoded_filename_422 | cut -f 1 -d ' '`
+MD5SUM_ORIG_444=`md5sum $encoded_filename_444 | cut -f 1 -d ' '`
+
+i=1
+while true;
+do
+ echo
+ echo "Iteration $i/$iterations:"
+
+ tjbench $1 $Q -rgb -quiet scale 1/2
+ MD5SUM_GRAY=`md5sum $encoded_filename_gray | cut -f 1 -d ' '`
+ MD5SUM_420=`md5sum $encoded_filename_420 | cut -f 1 -d ' '`
+ MD5SUM_422=`md5sum $encoded_filename_422 | cut -f 1 -d ' '`
+ MD5SUM_444=`md5sum $encoded_filename_444 | cut -f 1 -d ' '`
+
+ if [ $MD5SUM_GRAY = $MD5SUM_ORIG_GRAY ]; then
+ echo "Data corruption test: MD5SUM_GRAY: PASS"
+ else
+ echo "Data corruption test: MD5SUM_GRAY: FAIL"
+ exit 1
+ fi
+ if [ $MD5SUM_420 = $MD5SUM_ORIG_420 ]; then
+ echo "Data corruption test: MD5SUM_420: PASS"
+ else
+ echo "Data corruption test: MD5SUM_420: FAIL"
+ exit 1
+ fi
+ if [ $MD5SUM_422 = $MD5SUM_ORIG_422 ]; then
+ echo "Data corruption test: MD5SUM_422: PASS"
+ else
+ echo "Data corruption test: MD5SUM_422: FAIL"
+ exit 1
+ fi
+ if [ $MD5SUM_444 = $MD5SUM_ORIG_444 ]; then
+ echo "Data corruption test: MD5SUM_444: PASS"
+ else
+ echo "Data corruption test: MD5SUM_444: FAIL"
+ exit 1
+ fi
+
+ i=$((i+1))
+ if [ "$i" -gt "$iterations" ]; then
+ echo
+ echo "*** Data Corruption Test completed successfully"
+ exit 0
+ fi
+done
+
diff --git a/data-corruption/images/boxes.ppm b/data-corruption/images/boxes.ppm
new file mode 100644
index 0000000..59ece8f
--- /dev/null
+++ b/data-corruption/images/boxes.ppm
@@ -0,0 +1,33 @@
+P6
+63 63
+255
+ng}d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|h~q~[sDa:Y6V6V6V6V6V6V6V6V6V6V6V6V6V6V6V6V6V7V<ZHdaxkC_)J@<<<<<<<====<<<<<<=A-NJeucz7V?4
+0
+0 0 0
+0
+0
+0
+1
+1
+1
+1
+0
+0
+0 0 0
+0
+05 B?\l_x2R: /++++++,,,,,++++++, 1>:Xi^x2R9.******+,,,+******+
+0=9Xh^x2R9.******+,,,+******+
+0=9Xh^x1R9.******+,,,+******+
+0=9Xh^x1R9.******+,,,+******+
+0=9Xh]x1R9.******+,,,+******+
+0=9Xh\x0R9.******+,,,+******+
+0=9XhXx.R9.******+,,,+******+
+0=9XhRx+R9.******+,,,+******+
+0=9XhsJx'R9.******+,,,+******+
+0=9XheAx"R9.******+,,,+******+
+0=9Xhw[:xR9.******+,,,+******+
+0=9XhoT6xR9.******+,,,+******+
+0=9Xh}kR5xR9.+++++++,,,,+++++++
+0=9Xh|jR5xS<1-,,,,,,----,,,,,,- 2?;Zi|kS7| XB 7 3 3 3 3 3 3 3 4 4
+4
+4 3 3 3 3 3 338#EA^n}nW=)fQGCCCCCCCDDDDCCCC C C"D'H4TPky~q^I8}-k(c&b&b&b&b&b&b&b&b&b)b,b2b8b=b@bBbCbEbIdTnkxjZNFA@@@@@@@ABEKU`jortux}uld_]]]]]]]]]^blz~yvtsssssssssuz \ No newline at end of file
diff --git a/disk-io-stress-switcher/disk-io-stress-switcher.sh b/disk-io-stress-switcher/disk-io-stress-switcher.sh
new file mode 100755
index 0000000..df97f1e
--- /dev/null
+++ b/disk-io-stress-switcher/disk-io-stress-switcher.sh
@@ -0,0 +1,435 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Amit Pundir <amit.pundir@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo ""
+ echo "usage: $0 [<option> <argument>] .."
+ echo ""
+ echo "Options: -f <operating frequency> [big/little; Default: big]"
+ echo " -c <operate on this cpu> [this option can be specified multiple times]"
+ echo " -d <take this cpu offline>"
+ echo " -e <bring this cpu online>"
+ echo " -s <periodic switching interval in msec> [Default: 50]"
+ echo " -r <random switching seed> [Default: 100]"
+ echo " -l <random switching seed limit> [Default: 1000]"
+ echo " -n <threads to be executed on specific cpus>"
+ echo " -S single-sync Sequential half transition (e.g.: big->barrier->little->barrier)"
+ echo ""
+ echo "Example of periodic switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -s 50"
+ echo "Example of random switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -r 100 -l 1000"
+ echo "Example of periodic switching while spawning threads on cpu0 and cpu3: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -n 0 ... $large_cpu_number -s 50"
+ echo "Example of simultaneous thread while spawning threads on all cpus: $0 -f big -c 0 -n 0 ... $large_cpu_number -s 100 -S"
+ exit 1
+}
+
+IO_STATUS=0;
+SWITCHER_STATUS=0;
+
+total_no_of_cpu=`ls /sys/devices/system/cpu/cpu*/online | wc -l`
+large_cpu_number=$((total_no_of_cpu-1))
+
+TASKSET=affinity_tools
+
+CPU_FAST=
+CPU_SLOW=
+
+#ARM
+IMPLEMENTER=0x41
+#A7
+PART_SLOW=0xc07
+#A15
+PART_FAST=0xc0f
+eachslow=
+eachfast=
+EACH_CPU=
+
+get_no_of_cpus ()
+{
+ cpu=0
+ while [ $cpu -lt $total_no_of_cpu ];
+ do
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_SLOW >/dev/null
+ if [ $? == 0 ] ; then
+ eachslow=" -c "
+ CPU_SLOW=$CPU_SLOW$eachslow$cpu
+ fi
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_FAST >/dev/null
+ if [ $? == 0 ] ; then
+ eachfast=" -c "
+ CPU_FAST=$CPU_FAST$eachfast$cpu
+ fi
+ cpu=$((cpu+1))
+ done
+ EACH_CPU="$CPU_SLOW$CPU_FAST"
+}
+
+switch()
+{
+ if [ "$FREQ" -eq 0 ]; then
+ boot_a15
+ else if [ "$FREQ" -eq 1 ]; then
+ boot_a7
+ else
+ echo "Error: Unknown Operating frequency. Has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+}
+
+boot_a15()
+{
+ echo ""
+ echo "Switching to big mode if not already in."
+ boot-a15.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a15 failed. Abort!!"
+ exit 1
+ fi
+}
+
+boot_a7()
+{
+ echo ""
+ echo "Switching to little mode if not already in."
+ boot-a7.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a7 failed. Abort!!"
+ exit 1
+ fi
+}
+
+disable_cpu()
+{
+ echo ""
+ echo "Taking CPU$DISABLE_CPU offline .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$DISABLE_CPU/online`
+ if [ $STATUS -eq 1 ]; then
+ echo 0 > /sys/devices/system/cpu/cpu$DISABLE_CPU/online
+ else
+ echo "CPU$DISABLE_CPU already in offline mode."
+ fi
+}
+
+enable_cpu()
+{
+ echo ""
+ echo "Bringing CPU$ENABLE_CPU online .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$ENABLE_CPU/online`
+ if [ $STATUS -eq 0 ]; then
+ echo 1 > /sys/devices/system/cpu/cpu$ENABLE_CPU/online
+ else
+ echo "CPU$ENABLE_CPU already in online mode."
+ fi
+}
+
+run_iozone()
+{
+ echo ""
+ echo "Running iozone -a -i 0 -i 2 -s 16m -V teststring"
+ iozone -a -i 0 -i 2 -s 16m -V teststring
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "iozone failed. Abort!!"
+ IO_STATUS=$ERR_CODE;
+ return 1
+ else
+ echo "Iozone finished successfully"
+ return 0
+ fi
+}
+
+run_periodic_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE periodic switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR &"
+ bl-agitator -n $EACH_CPU -s $INTR &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE periodic switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+run_random_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE random switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &"
+ bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE random switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+
+simultaneous_thread_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE simultaneous thread switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR -S &"
+ bl-agitator -n $EACH_CPU -s $INTR -S &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE simultaneous thread switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+kill_switcher()
+{
+ echo ""
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ echo "Kill bigLITTLE switcher BL_AGITATOR_PID $BL_AGITATOR_PID"
+ echo "PID_BL_CHECK= $PID_BL_CHECK"
+
+ if [ -z "$PID_BL_CHECK" ]; then
+ echo "bigLITTLE switcher not running. Report Error!!"
+ exit 1
+ else
+ # done with bl-agitator. Kill the process
+ echo "sending SIGTERM BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill $BL_AGITATOR_PID
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ if [ -n "$PID_BL_CHECK_AGAIN" ]; then
+ #if the above kill is not successfull. kill forcefully
+ echo "sending SIGKILL BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill -9 $BL_AGITATOR_PID > /dev/null 2>&1
+ fi
+ fi
+}
+
+if [ -z "$1" ]; then
+ usage
+fi
+
+get_no_of_cpus
+
+while [ "$1" ]; do
+ case "$1" in
+ -f|--frequency)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ if [ "$2" = "big" ]; then
+ FREQ=0;
+ shift;
+ else if [ "$2" = "little" ]; then
+ FREQ=1;
+ shift;
+ else
+ echo "Error: Operating frequency has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+ ;;
+ -c|--cpu-num)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ CPU_NUM=$2;
+ if [ -z "$FREQ" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ switch
+ shift;
+ else
+ usage
+ fi
+ ;;
+ -s|--periodic-switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ PERIODIC_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ INTR=$2;
+ else
+ INTR=50;
+ fi
+ else
+ echo "Invalid option (-s) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Random switching mode"
+ fi
+ shift;
+ ;;
+ -r|--random-switching)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ RANDOM_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ SEED=$2;
+ else
+ SEED=100;
+ fi
+ else
+ echo "Invalid option (-r) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -l|--seed-limit)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ if [ -z "$SEED" ]; then
+ echo "Error: Specify the Seed for the random switcher [-r 100]"
+ usage
+ fi
+ if [ "$2" -gt 0 ]; then
+ LIMIT=$2;
+ else
+ LIMIT=1000;
+ fi
+ else
+ echo "Invalid option (-l) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -n|--thread-switching)
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU0="-c $2";
+ shift;
+ else
+ echo "Error: Must specify at least one CPU on which thread has to be spawned"
+ usage
+ fi
+ shift;
+ ;;
+ -S|--simultaneous_thread_switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ SIMULTANEOUS_THREAD_SWITCH=y;
+ else
+ echo "Invalid option (-S) !!"
+ echo "Can't do random and simultaneous thread switching at a time"
+ echo "Set to Random switching mode"
+ fi
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+if [ -z "$FREQ" ]; then
+ echo "Error: Frequency has to be set to either \"big\" or \"little\""
+ usage
+else if [ -z "$CPU_NUM" ]; then
+ echo "Error: Specify the number of CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+fi
+fi
+
+if [ "$PERIODIC_SWITCH" = "y" ]; then
+ if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ echo ""
+ else
+ run_periodic_switcher
+ fi
+fi
+
+if [ "$RANDOM_SWITCH" = "y" ]; then
+ if [ -z "$LIMIT" ]; then
+ echo "Error: Specify the Seed Limit for the random switcher [-l 1000]"
+ usage
+ fi
+ run_random_switcher
+fi
+
+if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ simultaneous_thread_switcher
+ cluster-status.sh $BL_AGITATOR_PID &
+fi
+
+run_iozone
+
+if ([ "$PERIODIC_SWITCH" = "y" ] || [ "$RANDOM_SWITCH" = "y" ] || [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]); then
+ kill_switcher
+fi
+
+if ([ $IO_STATUS -ne 0 ] || [ $SWITCHER_STATUS -ne 0 ]); then
+ echo "Test failed. Abort!!"
+ exit 1
+fi
+
+KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+if ([ -n "$KERNEL_ERR" ]); then
+ echo "Kernel OOPS detected. Abort!!"
+ exit 1
+fi
+
+exit 0
diff --git a/install-scripts-android.sh b/install-scripts-android.sh
new file mode 100755
index 0000000..4e0b7fc
--- /dev/null
+++ b/install-scripts-android.sh
@@ -0,0 +1,51 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo "usage: $0 <mmc image> "
+}
+
+if [ -z "$1" ]; then
+ usage
+ exit
+fi
+
+# mount the system partition
+mkdir /tmp/mmc/
+sudo mount -t ext4 -o loop,offset=138412032 $1 /tmp/mmc/
+
+# Copy the scripts and prebuilts
+find . -iname "*.sh" -execdir sudo cp '{}' /tmp/mmc/bin \;
+sudo cp android-prebuilts/* /tmp/mmc/bin/
+
+# unmount the system partition
+sudo umount -f /tmp/mmc/
+
+# mount the data partition
+sudo mount -t ext4 -o loop,offset=943734784 $1 /tmp/mmc/
+
+# Copy the image
+mkdir /tmp/mmc/boxes/
+sudo cp data-corruption/images/boxes.ppm /tmp/mmc/boxes/
+sudo cp vfp-ffmpeg/inputfiles/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG /tmp/mmc/boxes/
+
+# unmount the data partition
+sudo umount -f /tmp/mmc/
+rm -r /tmp/mmc/
diff --git a/install-scripts.mk b/install-scripts.mk
new file mode 100644
index 0000000..cf4fc00
--- /dev/null
+++ b/install-scripts.mk
@@ -0,0 +1,33 @@
+PRODUCT_COPY_FILES += \
+ test/linaro/biglittle/core/boot-a15/boot-a15.sh:system/bin/boot-a15.sh \
+ test/linaro/biglittle/core/boot-a7/boot-a7.sh:system/bin/boot-a7.sh \
+ test/linaro/biglittle/core/disk-io-stress-switcher/disk-io-stress-switcher.sh:system/bin/disk-io-stress-switcher.sh \
+ test/linaro/biglittle/core/mem-stress-switcher/mem-stress-switcher.sh:system/bin/mem-stress-switcher.sh \
+ test/linaro/biglittle/core/data-corruption-switcher/data-corruption-switcher.sh:system/bin/data-corruption-switcher.sh \
+ test/linaro/biglittle/core/data-corruption/data-corruption.sh:system/bin/data-corruption.sh \
+ test/linaro/biglittle/core/data-corruption/images/boxes.ppm:data/boxes/boxes.ppm \
+ test/linaro/biglittle/core/basic/module.sh:system/bin/module.sh \
+ test/linaro/biglittle/core/basic/governor.sh:system/bin/governor.sh \
+ test/linaro/biglittle/core/basic/switch.sh:system/bin/switch.sh \
+ test/linaro/biglittle/core/basic/run-bl-basic-tests.sh:system/bin/run-bl-basic-tests.sh \
+ test/linaro/biglittle/core/cache-coherency-switcher/cache-coherency-switcher.sh:system/bin/cache-coherency-switcher.sh \
+ test/linaro/biglittle/core/basic/switcher-tests/100_switches.sh:system/bin/100_switches.sh \
+ test/linaro/biglittle/core/basic/switcher-tests/fastswitch.sh:system/bin/fastswitch.sh \
+ test/linaro/biglittle/core/basic/switcher-tests/reswitch.sh:system/bin/reswitch.sh \
+ test/linaro/biglittle/core/basic/switcher-tests/switcher-tests.sh:system/bin/switcher-tests.sh \
+ test/linaro/biglittle/core/basic/switcher-tests/try_rmmod.sh:system/bin/try_rmmod.sh \
+ test/linaro/biglittle/core/basic/switcher-tests/switcher_enable_disable.sh:system/bin/switcher_enable_disable.sh \
+ test/linaro/biglittle/core/basic/switcher-tests/switcher_off_hotplug_cpu.sh:system/bin/switcher_off_hotplug_cpu.sh \
+ test/linaro/biglittle/core/vfp-ffmpeg-switcher/vfp-ffmpeg-switcher.sh:system/bin/vfp-ffmpeg-switcher.sh \
+ test/linaro/biglittle/core/vfp-ffmpeg/vfp-ffmpeg.sh:system/bin/vfp-ffmpeg.sh \
+ test/linaro/biglittle/core/vfp-ffmpeg/inputfiles/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG:data/boxes/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG \
+ test/linaro/biglittle/core/cluster-status/cluster-status.sh:system/bin/cluster-status.sh \
+ test/linaro/biglittle/core/interactive-governor-test.sh:system/bin/interactive-governor-test.sh \
+ test/linaro/biglittle/core/run_stress_switcher_tests.sh:system/bin/run_stress_switcher_tests.sh \
+ test/linaro/biglittle/core/cpu_freq_vs_cluster_freq/cpu_freq_cope_on_cluster_freq.sh:system/bin/cpu_freq_cope_on_cluster_freq.sh \
+ test/linaro/biglittle/core/cpu_freq_vs_cluster_freq/cpu_freq_vs_cluster_freq.sh:system/bin/cpu_freq_vs_cluster_freq.sh \
+ test/linaro/biglittle/core/cpu_freq_vs_cluster_freq/inputfiles/cpu_freq_cope_on_cluster_freq_output_org.log:data/boxes/cpu_freq_cope_on_cluster_freq_output_org.log \
+ test/linaro/biglittle/core/perf-count-events/perf-disk-io-stress-switcher.sh:system/bin/perf-disk-io-stress-switcher.sh \
+ test/linaro/biglittle/core/perf-count-events/perf-mem-stress-switcher.sh:system/bin/perf-mem-stress-switcher.sh
+
+PRODUCT_PACKAGES += affinity_tools
diff --git a/interactive-governor-test.sh b/interactive-governor-test.sh
new file mode 100755
index 0000000..83657e3
--- /dev/null
+++ b/interactive-governor-test.sh
@@ -0,0 +1,141 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Amit Pundir <amit.pundir@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+get_governor()
+{
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules
+ if [ -d $ANDROID_MOD_PATH ]; then
+ GOVERNOR="interactive"
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ GOVERNOR="ondemand"
+ else
+ echo "ERROR: get_governors failed"
+ exit 1
+ fi
+ fi
+}
+
+check_kernel_oops()
+{
+ KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+ if [ -n "$KERNEL_ERR" ]; then
+ echo "Kernel OOPS. Abort!!"
+ exit 1
+ fi
+}
+
+insert_bl_module()
+{
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+ if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ GOVERNOR="interactive"
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ GOVERNOR="ondemand"
+ else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+ fi
+ fi
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+ if [ -z "$CPU_FREQ_KM" ]; then
+ insmod $MOD_LOCATION
+ fi
+ check_kernel_oops
+}
+
+set_governor()
+{
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+ do echo $GOVERNOR > $file
+ done
+ sleep 5;
+}
+
+reset_governor()
+{
+ GOVERNOR="userspace"
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+ do echo $GOVERNOR > $file
+ done
+ sleep 5;
+}
+
+check_operating_frequency()
+{
+ i=0
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
+ do freq=`cat $file`
+ if [ "$freq" -eq "$BIG" ]; then
+ echo "cpu$i operating in BIG mode at $freq"
+ else if [ "$freq" -eq "$LITTLE" ] ; then
+ echo "cpu$i operating in LITTLE mode at $freq"
+ else
+ echo "cpu$i operating at $freq"
+ fi
+ fi
+ i=$((i+1))
+ done
+}
+
+run_memtester()
+{
+ memtester 1M 1 &
+ sleep 5;
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules
+ if [ -d $ANDROID_MOD_PATH ]; then
+ while [ `ps | grep -v grep | grep memtester | wc -l` -eq 1 ]; do
+ check_operating_frequency
+ sleep 20;
+ done
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ while [ `ps ax | grep -v grep | grep memtester | wc -l` -eq 1 ]; do
+ check_operating_frequency
+ sleep 20;
+ done
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+}
+
+# insert bl module is intended for RTSM
+MODEL=`cat /proc/device-tree/model`
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ echo "insert bl module from interactive-governor-test.sh"
+ insert_bl_module
+fi
+
+BIG=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+LITTLE=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+
+get_governor
+set_governor
+check_operating_frequency
+run_memtester
+check_operating_frequency
+reset_governor
+
+exit 0
diff --git a/mem-stress-switcher/mem-stress-switcher.sh b/mem-stress-switcher/mem-stress-switcher.sh
new file mode 100755
index 0000000..bf7960c
--- /dev/null
+++ b/mem-stress-switcher/mem-stress-switcher.sh
@@ -0,0 +1,471 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Amit Pundir <amit.pundir@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo ""
+ echo "usage: $0 [<option> <argument>] .."
+ echo ""
+ echo "Options: -f <operating frequency> [big/little; Default: big]"
+ echo " -c <operate on this cpu> [this option can be specified multiple times]"
+ echo " -d <take this cpu offline>"
+ echo " -e <bring this cpu online>"
+ echo " -i <number of iterations> [Default: 1]"
+ echo " -m <amount of memory> [Default: 1M]"
+ echo " -s <periodic switching interval in msec> [Default: 50]"
+ echo " -r <random switching seed> [Default: 100]"
+ echo " -l <random switching seed limit> [Default: 1000]"
+ echo " -n <threads to be executed on specific cpus>"
+ echo " -S single-sync Sequential half transition (e.g.: big->barrier->little->barrier)"
+ echo ""
+ echo "Example of periodic switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -s 50"
+ echo "Example of random switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -r 100 -l 1000"
+ echo "Example of periodic switching while spawning threads on cpu0 and cpu3: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -n 0 ... $large_cpu_number -s 50"
+ echo "Example of simultaneous thread while spawning threads on all cpus: $0 -f big -c 0 -n 0 ... $large_cpu_number -s 100 -S"
+ exit 1
+}
+
+MEM_STATUS=0;
+SWITCHER_STATUS=0;
+
+total_no_of_cpu=`ls /sys/devices/system/cpu/cpu*/online | wc -l`
+large_cpu_number=$((total_no_of_cpu-1))
+
+TASKSET=affinity_tools
+
+CPU_FAST=
+CPU_SLOW=
+
+#ARM
+IMPLEMENTER=0x41
+#A7
+PART_SLOW=0xc07
+#A15
+PART_FAST=0xc0f
+eachslow=
+eachfast=
+EACH_CPU=
+
+get_no_of_cpus ()
+{
+ cpu=0
+ while [ $cpu -lt $total_no_of_cpu ];
+ do
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_SLOW >/dev/null
+ if [ $? == 0 ] ; then
+ eachslow=" -c "
+ CPU_SLOW=$CPU_SLOW$eachslow$cpu
+ fi
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_FAST >/dev/null
+ if [ $? == 0 ] ; then
+ eachfast=" -c "
+ CPU_FAST=$CPU_FAST$eachfast$cpu
+ fi
+ cpu=$((cpu+1))
+ done
+ EACH_CPU="$CPU_SLOW$CPU_FAST"
+}
+
+switch()
+{
+ if [ "$FREQ" -eq 0 ]; then
+ boot_a15
+ else if [ "$FREQ" -eq 1 ]; then
+ boot_a7
+ else
+ echo "Error: Unknown Operating frequency. Has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+}
+
+boot_a15()
+{
+ echo ""
+ echo "Switching to big mode if not already in."
+ boot-a15.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a15 failed. Abort!!"
+ exit 1
+ fi
+}
+
+boot_a7()
+{
+ echo ""
+ echo "Switching to little mode if not already in."
+ boot-a7.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a7 failed. Abort!!"
+ exit 1
+ fi
+}
+
+disable_cpu()
+{
+ echo ""
+ echo "Taking CPU$DISABLE_CPU offline .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$DISABLE_CPU/online`
+ if [ $STATUS -eq 1 ]; then
+ echo 0 > /sys/devices/system/cpu/cpu$DISABLE_CPU/online
+ else
+ echo "CPU$DISABLE_CPU already in offline mode."
+ fi
+}
+
+enable_cpu()
+{
+ echo ""
+ echo "Bringing CPU$ENABLE_CPU online .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$ENABLE_CPU/online`
+ if [ $STATUS -eq 0 ]; then
+ echo 1 > /sys/devices/system/cpu/cpu$ENABLE_CPU/online
+ else
+ echo "CPU$ENABLE_CPU already in online mode."
+ fi
+}
+
+run_memtester()
+{
+ # Set defaults for Memtester
+ if [ -z "$MEM" ]; then
+ MEM=1;
+ fi
+ if [ -z "$ITR" ]; then
+ ITR=1;
+ fi
+
+ echo ""
+ echo "Running memtester "$MEM"M "$ITR""
+ memtester "$MEM"M $ITR
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "memtester failed. Abort!!"
+ MEM_STATUS=$ERR_CODE;
+ return 1
+ else
+ echo "Memtester finished successfully"
+ return 0
+ fi
+}
+
+run_periodic_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE periodic switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR &"
+ bl-agitator -n $EACH_CPU -s $INTR &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE periodic switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+run_random_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE random switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &"
+ bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE random switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+simultaneous_thread_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE simultaneous thread switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR -S &"
+ bl-agitator -n $EACH_CPU -s $INTR -S &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE simultaneous thread switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+kill_switcher()
+{
+ echo ""
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ echo "Kill bigLITTLE switcher BL_AGITATOR_PID $BL_AGITATOR_PID"
+ echo "PID_BL_CHECK= $PID_BL_CHECK"
+
+ if [ -z "$PID_BL_CHECK" ]; then
+ echo "bigLITTLE switcher not running. Report Error!!"
+ exit 1
+ else
+ # done with bl-agitator. Kill the process
+ echo "sending SIGTERM BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill $BL_AGITATOR_PID
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ if [ -n "$PID_BL_CHECK_AGAIN" ]; then
+ #if the above kill is not successfull. kill forcefully
+ echo "sending SIGKILL BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill -9 $BL_AGITATOR_PID > /dev/null 2>&1
+ fi
+ fi
+}
+
+if [ -z "$1" ]; then
+ usage
+fi
+
+get_no_of_cpus
+
+while [ "$1" ]; do
+ case "$1" in
+ -f|--frequency)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ if [ "$2" = "big" ]; then
+ FREQ=0;
+ shift;
+ else if [ "$2" = "little" ]; then
+ FREQ=1;
+ shift;
+ else
+ echo "Error: Operating frequency has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+ ;;
+ -c|--cpu-num)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ CPU_NUM=$2;
+ if [ -z "$FREQ" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ switch
+ shift;
+ else
+ usage
+ fi
+ ;;
+ -d|--disable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ DISABLE_CPU=$2;
+ disable_cpu
+ shift;
+ fi
+ ;;
+ -e|--enable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ ENABLE_CPU=$2;
+ enable_cpu
+ shift;
+ fi
+ ;;
+ -i|--iterations)
+ if [ "$2" -gt 0 ]; then
+ ITR=$2;
+ shift;
+ fi
+ ;;
+ -m|--memory)
+ if [ "$2" -gt 0 ]; then
+ MEM=$2;
+ shift;
+ fi
+ ;;
+ -s|--periodic-switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ PERIODIC_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ INTR=$2;
+ else
+ INTR=50;
+ fi
+ else
+ echo "Invalid option (-s) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Random switching mode"
+ fi
+ shift;
+ ;;
+ -r|--random-switching)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ RANDOM_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ SEED=$2;
+ else
+ SEED=100;
+ fi
+ else
+ echo "Invalid option (-r) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -l|--seed-limit)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ if [ -z "$SEED" ]; then
+ echo "Error: Specify the Seed for the random switcher [-r 100]"
+ usage
+ fi
+ if [ "$2" -gt 0 ]; then
+ LIMIT=$2;
+ else
+ LIMIT=1000;
+ fi
+ else
+ echo "Invalid option (-l) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -n|--thread-switching)
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU0="-c $2";
+ shift;
+ else
+ echo "Error: Must specify at least one CPU on which thread has to be spawned"
+ usage
+ fi
+ shift;
+ ;;
+ -S|--simultaneous_thread_switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ SIMULTANEOUS_THREAD_SWITCH=y;
+ else
+ echo "Invalid option (-S) !!"
+ echo "Can't do random and simultaneous thread switching at a time"
+ echo "Set to Random switching mode"
+ fi
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+if [ -z "$FREQ" ]; then
+ echo "Error: Frequency has to be set to either \"big\" or \"little\""
+ usage
+else if [ -z "$CPU_NUM" ]; then
+ echo "Error: Specify the number of CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+fi
+fi
+
+if [ "$PERIODIC_SWITCH" = "y" ]; then
+ if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ echo ""
+ else
+ run_periodic_switcher
+ fi
+fi
+
+if [ "$RANDOM_SWITCH" = "y" ]; then
+ if [ -z "$LIMIT" ]; then
+ echo "Error: Specify the Seed Limit for the random switcher [-l 1000]"
+ usage
+ fi
+ run_random_switcher
+fi
+
+if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ simultaneous_thread_switcher
+ cluster-status.sh $BL_AGITATOR_PID &
+fi
+
+
+run_memtester
+
+if ([ "$PERIODIC_SWITCH" = "y" ] || [ "$RANDOM_SWITCH" = "y" ] || [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]); then
+ kill_switcher
+fi
+
+if ([ $MEM_STATUS -ne 0 ] || [ $SWITCHER_STATUS -ne 0 ]); then
+ echo "Test failed. Abort!!"
+ exit 1
+fi
+
+KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+if [ -n "$KERNEL_ERR" ]; then
+ echo "Kernel OOPS detected. Abort!!"
+ exit 1
+fi
+
+exit 0
diff --git a/perf-count-events/perf-disk-io-stress-switcher.sh b/perf-count-events/perf-disk-io-stress-switcher.sh
new file mode 100755
index 0000000..847e85e
--- /dev/null
+++ b/perf-count-events/perf-disk-io-stress-switcher.sh
@@ -0,0 +1,457 @@
+# Copyright (C) 2013, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo ""
+ echo "usage: $0 [<option> <argument>] .."
+ echo ""
+ echo "Options: -f <operating frequency> [big/little; Default: big]"
+ echo " -c <operate on this cpu> [this option can be specified multiple times]"
+ echo " -d <take this cpu offline>"
+ echo " -e <bring this cpu online>"
+ echo " -s <periodic switching interval in msec> [Default: 50]"
+ echo " -r <random switching seed> [Default: 100]"
+ echo " -l <random switching seed limit> [Default: 1000]"
+ echo " -n <threads to be executed on specific cpus>"
+ echo ""
+ echo "Example of periodic switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -s 50"
+ echo "Example of random switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -r 100 -l 1000"
+ echo "Example of periodic switching while spawning threads on cpu0 and cpu3: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -n 0 ... $large_cpu_number -s 50"
+ exit 1
+}
+
+IO_STATUS=0;
+SWITCHER_STATUS=0;
+PERF_STATUS=0;
+OUTFILE="/data/local/each-perf-disk-io-output.txt"
+EVENTS="stat -o $OUTFILE -e ARMv7_Cortex_A15/config=17/ -e ARMv7_Cortex_A7/config=17/"
+FILE="/data/local/perf-disk-io-output.txt"
+
+rm -rf $FILE
+rm -rf $OUTFILE
+
+total_no_of_cpu=`cat /proc/cpuinfo | grep proc | wc -l`
+large_cpu_number=$((total_no_of_cpu-1))
+
+TASKSET=affinity_tools
+
+CPU_FAST=
+CPU_SLOW=
+
+#ARM
+IMPLEMENTER=0x41
+#A7
+PART_SLOW=0xc07
+#A15
+PART_FAST=0xc0f
+eachslow=
+eachfast=
+EACH_CPU=
+
+get_no_of_cpus ()
+{
+ cpu=0
+ while [ $cpu -lt $total_no_of_cpu ];
+ do
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_SLOW >/dev/null
+ if [ $? == 0 ] ; then
+ eachslow=" -c "
+ CPU_SLOW=$CPU_SLOW$eachslow$cpu
+ fi
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_FAST >/dev/null
+ if [ $? == 0 ] ; then
+ eachfast=" -c "
+ CPU_FAST=$CPU_FAST$eachfast$cpu
+ fi
+ cpu=$((cpu+1))
+ done
+ EACH_CPU="$CPU_SLOW$CPU_FAST"
+}
+
+switch()
+{
+ if [ "$FREQ" -eq 0 ]; then
+ boot_a15
+ else if [ "$FREQ" -eq 1 ]; then
+ boot_a7
+ else
+ echo "Error: Unknown Operating frequency. Has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+}
+
+boot_a15()
+{
+ echo ""
+ echo "Switching to big mode if not already in."
+ boot-a15.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a15 failed. Abort!!"
+ exit 1
+ fi
+}
+
+boot_a7()
+{
+ echo ""
+ echo "Switching to little mode if not already in."
+ boot-a7.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a7 failed. Abort!!"
+ exit 1
+ fi
+}
+
+disable_cpu()
+{
+ echo ""
+ echo "Taking CPU$DISABLE_CPU offline .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$DISABLE_CPU/online`
+ if [ $STATUS -eq 1 ]; then
+ echo 0 > /sys/devices/system/cpu/cpu$DISABLE_CPU/online
+ else
+ echo "CPU$DISABLE_CPU already in offline mode."
+ fi
+}
+
+enable_cpu()
+{
+ echo ""
+ echo "Bringing CPU$ENABLE_CPU online .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$ENABLE_CPU/online`
+ if [ $STATUS -eq 0 ]; then
+ echo 1 > /sys/devices/system/cpu/cpu$ENABLE_CPU/online
+ else
+ echo "CPU$ENABLE_CPU already in online mode."
+ fi
+}
+
+run_perf_iozone()
+{
+ i=$1
+ while test $i -gt 0 ; do
+ echo ""
+ echo "Running iozone -a -i 0 -i 2 -s 16m -V teststring"
+ perf $EVENTS iozone -a -i 0 -i 2 -s 16m -V teststring
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "iozone failed. Abort!!"
+ IO_STATUS=$ERR_CODE;
+ return 1
+ else
+ echo "iozone finished successfully"
+ fi
+
+ if ( test "$NON_SWITCHER" = "y" )
+ then
+ non_zero_count=`grep $NON_ZERO_COUNT $OUTFILE | cut -d"A" -f1`
+ zero_count=`grep $ZERO_COUNT $OUTFILE | cut -d"A" -f1`
+ if ( test $non_zero_count -ne 0 && test $zero_count = 0 )
+ then
+ echo "event count on active cluster $CLUSTER is $non_zero_count"
+ echo "event count on in-active cluster $IN_ACTIVE_CLUSTER count is $zero_count"
+ else
+ echo "event count on active cluster $CLUSTER is $non_zero_count"
+ echo "event count on in-active cluster $IN_ACTIVE_CLUSTER count is $zero_count"
+ echo "TEST FAILED"
+ PERF_STATUS=1
+ fi
+ else if ( test "$SWITCHER" = "y" )
+ then
+ a15_event_count=`grep ARMv7_Cortex_A15 $OUTFILE | cut -d"A" -f1`
+ a7_event_count=`grep ARMv7_Cortex_A7 $OUTFILE | cut -d"A" -f1`
+ if ( test $a15_event_count -ne 0 && test $a7_event_count -ne 0 )
+ then
+ echo "a15_event_count= $a15_event_count"
+ echo "a7_event_count= $a7_event_count"
+ echo "while switcher is active, the count is non zero on a15 and a7 clusters"
+ else
+ echo "a15_event_count= $a15_event_count"
+ echo "a7_event_count= $a7_event_count"
+ echo "count zero on a15 and a7 clusters"
+ echo "TEST FAILED"
+ PERF_STATUS=1
+ fi
+ else
+ echo "Unknown mode"
+ fi
+ fi
+ i=$(($i-1))
+ done
+}
+
+run_periodic_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE periodic switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR &"
+ bl-agitator -n $EACH_CPU -s $INTR &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE periodic switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+run_random_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE random switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &"
+ bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE random switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+kill_switcher()
+{
+ echo ""
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ echo "Kill bigLITTLE switcher BL_AGITATOR_PID $BL_AGITATOR_PID"
+ echo "PID_BL_CHECK= $PID_BL_CHECK"
+
+ if [ -z "$PID_BL_CHECK" ]; then
+ echo "bigLITTLE switcher not running. Report Error!!"
+ exit 1
+ else
+ # done with bl-agitator. Kill the process
+ echo "sending SIGTERM BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill $BL_AGITATOR_PID
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ if [ -n "$PID_BL_CHECK_AGAIN" ]; then
+ #if the above kill is not successfull. kill forcefully
+ echo "sending SIGKILL BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill -9 $BL_AGITATOR_PID > /dev/null 2>&1
+ fi
+ fi
+}
+
+if [ -z "$1" ]; then
+ usage
+fi
+
+get_no_of_cpus
+
+while [ "$1" ]; do
+ case "$1" in
+ -a7|--a7-only)
+ if [ $(echo "$2" | grep -E "^[1-2]+$") ]; then
+ NON_ZERO_COUNT="ARMv7_Cortex_A7"
+ ZERO_COUNT="ARMv7_Cortex_A15"
+ NON_SWITCHER="y"
+ CLUSTER="a7"
+ IN_ACTIVE_CLUSTER="a15"
+ shift;
+ fi
+ ;;
+ -a15|--a15-only)
+ if [ $(echo "$2" | grep -E "^[1-2]+$") ]; then
+ ZERO_COUNT="ARMv7_Cortex_A7"
+ NON_ZERO_COUNT="ARMv7_Cortex_A15"
+ NON_SWITCHER="y"
+ CLUSTER="a15"
+ IN_ACTIVE_CLUSTER="a7"
+ shift;
+ fi
+ ;;
+ -f|--frequency)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ if [ "$2" = "big" ]; then
+ FREQ=0;
+ shift;
+ else if [ "$2" = "little" ]; then
+ FREQ=1;
+ shift;
+ else
+ echo "Error: Operating frequency has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+ ;;
+ -c|--cpu-num)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ CPU_NUM=$2;
+ if [ -z "$FREQ" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ switch
+ shift;
+ else
+ usage
+ fi
+ ;;
+ -s|--periodic-switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ PERIODIC_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ INTR=$2;
+ else
+ INTR=50;
+ fi
+ SWITCHER="y"
+ else
+ echo "Invalid option (-s) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Random switching mode"
+ fi
+ shift;
+ ;;
+ -r|--random-switching)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ RANDOM_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ SEED=$2;
+ else
+ SEED=100;
+ fi
+ SWITCHER="y"
+ else
+ echo "Invalid option (-r) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -l|--seed-limit)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ if [ -z "$SEED" ]; then
+ echo "Error: Specify the Seed for the random switcher [-r 100]"
+ usage
+ fi
+ if [ "$2" -gt 0 ]; then
+ LIMIT=$2;
+ else
+ LIMIT=1000;
+ fi
+ else
+ echo "Invalid option (-l) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -n|--thread-switching)
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU0="-c $2";
+ shift;
+ else
+ echo "Error: Must specify at least one CPU on which thread has to be spawned"
+ usage
+ fi
+ shift;
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+if [ -z "$FREQ" ]; then
+ echo "Error: Frequency has to be set to either \"big\" or \"little\""
+ usage
+else if [ -z "$CPU_NUM" ]; then
+ echo "Error: Specify the number of CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+fi
+fi
+
+if [ "$PERIODIC_SWITCH" = "y" ]; then
+ run_periodic_switcher
+fi
+
+if [ "$RANDOM_SWITCH" = "y" ]; then
+ if [ -z "$LIMIT" ]; then
+ echo "Error: Specify the Seed Limit for the random switcher [-l 1000]"
+ usage
+ fi
+ run_random_switcher
+fi
+
+run_perf_iozone 10
+
+if ([ "$PERIODIC_SWITCH" = "y" ] || [ "$RANDOM_SWITCH" = "y" ]); then
+ kill_switcher
+fi
+
+if ([ $IO_STATUS -ne 0 ] || [ $SWITCHER_STATUS -ne 0 ] || [ $PERF_STATUS -ne 0 ]); then
+ echo "Test failed. Abort!!"
+ exit 1
+fi
+
+KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+if ([ -n "$KERNEL_ERR" ]); then
+ echo "Kernel OOPS detected. Abort!!"
+ exit 1
+fi
+
+exit 0
diff --git a/perf-count-events/perf-mem-stress-switcher.sh b/perf-count-events/perf-mem-stress-switcher.sh
new file mode 100755
index 0000000..93acdfe
--- /dev/null
+++ b/perf-count-events/perf-mem-stress-switcher.sh
@@ -0,0 +1,493 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo ""
+ echo "usage: $0 [<option> <argument>] .."
+ echo ""
+ echo "Options: -f <operating frequency> [big/little; Default: big]"
+ echo " -c <operate on this cpu> [this option can be specified multiple times]"
+ echo " -d <take this cpu offline>"
+ echo " -e <bring this cpu online>"
+ echo " -i <number of iterations> [Default: 1]"
+ echo " -m <amount of memory> [Default: 1M]"
+ echo " -s <periodic switching interval in msec> [Default: 50]"
+ echo " -r <random switching seed> [Default: 100]"
+ echo " -l <random switching seed limit> [Default: 1000]"
+ echo " -n <threads to be executed on specific cpus>"
+ echo ""
+ echo "Example of periodic switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -s 50"
+ echo "Example of random switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -r 100 -l 1000"
+ echo "Example of periodic switching while spawning threads on cpu0 and cpu3: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -n 0 ... $large_cpu_number -s 50"
+ exit 1
+}
+
+MEM_STATUS=0;
+SWITCHER_STATUS=0;
+PERF_STATUS=0;
+OUTFILE="/data/local/each-perf-mem-output.txt"
+EVENTS="stat -o $OUTFILE -e ARMv7_Cortex_A15/config=17/ -e ARMv7_Cortex_A7/config=17/"
+FILE="/data/local/perf-mem-output.txt"
+
+rm -rf $FILE
+rm -rf $OUTFILE
+
+total_no_of_cpu=`cat /proc/cpuinfo | grep proc | wc -l`
+large_cpu_number=$((total_no_of_cpu-1))
+
+TASKSET=affinity_tools
+
+CPU_FAST=
+CPU_SLOW=
+
+#ARM
+IMPLEMENTER=0x41
+#A7
+PART_SLOW=0xc07
+#A15
+PART_FAST=0xc0f
+eachslow=
+eachfast=
+EACH_CPU=
+
+get_no_of_cpus ()
+{
+ cpu=0
+ while [ $cpu -lt $total_no_of_cpu ];
+ do
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_SLOW >/dev/null
+ if [ $? == 0 ] ; then
+ eachslow=" -c "
+ CPU_SLOW=$CPU_SLOW$eachslow$cpu
+ fi
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_FAST >/dev/null
+ if [ $? == 0 ] ; then
+ eachfast=" -c "
+ CPU_FAST=$CPU_FAST$eachfast$cpu
+ fi
+ cpu=$((cpu+1))
+ done
+ EACH_CPU="$CPU_SLOW$CPU_FAST"
+}
+
+switch()
+{
+ if [ "$FREQ" -eq 0 ]; then
+ boot_a15
+ else if [ "$FREQ" -eq 1 ]; then
+ boot_a7
+ else
+ echo "Error: Unknown Operating frequency. Has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+}
+
+boot_a15()
+{
+ echo ""
+ echo "Switching to big mode if not already in."
+ boot-a15.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a15 failed. Abort!!"
+ exit 1
+ fi
+}
+
+boot_a7()
+{
+ echo ""
+ echo "Switching to little mode if not already in."
+ boot-a7.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a7 failed. Abort!!"
+ exit 1
+ fi
+}
+
+disable_cpu()
+{
+ echo ""
+ echo "Taking CPU$DISABLE_CPU offline .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$DISABLE_CPU/online`
+ if [ $STATUS -eq 1 ]; then
+ echo 0 > /sys/devices/system/cpu/cpu$DISABLE_CPU/online
+ else
+ echo "CPU$DISABLE_CPU already in offline mode."
+ fi
+}
+
+enable_cpu()
+{
+ echo ""
+ echo "Bringing CPU$ENABLE_CPU online .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$ENABLE_CPU/online`
+ if [ $STATUS -eq 0 ]; then
+ echo 1 > /sys/devices/system/cpu/cpu$ENABLE_CPU/online
+ else
+ echo "CPU$ENABLE_CPU already in online mode."
+ fi
+}
+
+run_perf_memtester()
+{
+ # Set defaults for Memtester
+ if [ -z "$MEM" ]; then
+ MEM=1;
+ fi
+ if [ -z "$ITR" ]; then
+ ITR=1;
+ fi
+
+ i=$1
+ while test $i -gt 0 ; do
+ echo ""
+ echo "Running memtester "$MEM"M "$ITR""
+ perf $EVENTS memtester "$MEM"M $ITR
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "memtester failed. Abort!!"
+ MEM_STATUS=$ERR_CODE;
+ return 1
+ else
+ echo "Memtester finished successfully"
+ fi
+
+ if ( test "$NON_SWITCHER" = "y" )
+ then
+ non_zero_count=`grep $NON_ZERO_COUNT $OUTFILE | cut -d"A" -f1`
+ zero_count=`grep $ZERO_COUNT $OUTFILE | cut -d"A" -f1`
+ if ( test $non_zero_count -ne 0 && test $zero_count = 0 )
+ then
+ echo "event count on active cluster $CLUSTER is $non_zero_count"
+ echo "event count on in-active cluster $IN_ACTIVE_CLUSTER is $zero_count"
+ else
+ echo "event count active cluster $CLUSTER is $non_zero_count"
+ echo "event count on in-active cluster $IN_ACTIVE_CLUSTER is $zero_count"
+ echo "TEST FAILED"
+ PERF_STATUS=1
+ fi
+ else if ( test "$SWITCHER" = "y" )
+ then
+ a15_event_count=`grep ARMv7_Cortex_A15 $OUTFILE | cut -d"A" -f1`
+ a7_event_count=`grep ARMv7_Cortex_A7 $OUTFILE | cut -d"A" -f1`
+ if ( test $a15_event_count -ne 0 && test $a7_event_count -ne 0 )
+ then
+ echo " a15_event_count= $a15_event_count"
+ echo " a7_event_count= $a7_event_count"
+ echo "while switcher is active, the count is non zero on a15 and a7 clusters"
+ else
+ echo " a15_event_count= $a15_event_count"
+ echo " a7_event_count= $a7_event_count"
+ echo "count zero on a15 and a7 clusters"
+ echo "TEST FAILED"
+ PERF_STATUS=1
+ fi
+ else
+ echo "Unknown mode"
+ fi
+ fi
+ i=$(($i-1))
+ done
+}
+
+run_periodic_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE periodic switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR &"
+ bl-agitator -n $EACH_CPU -s $INTR &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE periodic switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+run_random_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE random switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &"
+ bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE random switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+kill_switcher()
+{
+ echo ""
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ echo "Kill bigLITTLE switcher BL_AGITATOR_PID $BL_AGITATOR_PID"
+ echo "PID_BL_CHECK= $PID_BL_CHECK"
+
+ if [ -z "$PID_BL_CHECK" ]; then
+ echo "bigLITTLE switcher not running. Report Error!!"
+ exit 1
+ else
+ # done with bl-agitator. Kill the process
+ echo "sending SIGTERM BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill $BL_AGITATOR_PID
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ if [ -n "$PID_BL_CHECK_AGAIN" ]; then
+ #if the above kill is not successfull. kill forcefully
+ echo "sending SIGKILL BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill -9 $BL_AGITATOR_PID > /dev/null 2>&1
+ fi
+ fi
+}
+
+if [ -z "$1" ]; then
+ usage
+fi
+
+get_no_of_cpus
+
+while [ "$1" ]; do
+ case "$1" in
+ -a7|--a7-only)
+ if [ $(echo "$2" | grep -E "^[1-2]+$") ]; then
+ NON_ZERO_COUNT="ARMv7_Cortex_A7"
+ ZERO_COUNT="ARMv7_Cortex_A15"
+ NON_SWITCHER="y"
+ CLUSTER="a7"
+ IN_ACTIVE_CLUSTER="a15"
+ shift;
+ fi
+ ;;
+ -a15|--a15-only)
+ if [ $(echo "$2" | grep -E "^[1-2]+$") ]; then
+ ZERO_COUNT="ARMv7_Cortex_A7"
+ NON_ZERO_COUNT="ARMv7_Cortex_A15"
+ NON_SWITCHER="y"
+ CLUSTER="a15"
+ IN_ACTIVE_CLUSTER="a7"
+ shift;
+ fi
+ ;;
+ -f|--frequency)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ if [ "$2" = "big" ]; then
+ FREQ=0;
+ shift;
+ else if [ "$2" = "little" ]; then
+ FREQ=1;
+ shift;
+ else
+ echo "Error: Operating frequency has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+ ;;
+ -c|--cpu-num)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ CPU_NUM=$2;
+ if [ -z "$FREQ" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ switch
+ shift;
+ else
+ usage
+ fi
+ ;;
+ -d|--disable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ DISABLE_CPU=$2;
+ disable_cpu
+ shift;
+ fi
+ ;;
+ -e|--enable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ ENABLE_CPU=$2;
+ enable_cpu
+ shift;
+ fi
+ ;;
+ -i|--iterations)
+ if [ "$2" -gt 0 ]; then
+ ITR=$2;
+ shift;
+ fi
+ ;;
+ -m|--memory)
+ if [ "$2" -gt 0 ]; then
+ MEM=$2;
+ shift;
+ fi
+ ;;
+ -s|--periodic-switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ PERIODIC_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ INTR=$2;
+ else
+ INTR=50;
+ fi
+ SWITCHER="y"
+ else
+ echo "Invalid option (-s) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Random switching mode"
+ fi
+ shift;
+ ;;
+ -r|--random-switching)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ RANDOM_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ SEED=$2;
+ else
+ SEED=100;
+ fi
+ SWITCHER="y"
+ else
+ echo "Invalid option (-r) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -l|--seed-limit)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ if [ -z "$SEED" ]; then
+ echo "Error: Specify the Seed for the random switcher [-r 100]"
+ usage
+ fi
+ if [ "$2" -gt 0 ]; then
+ LIMIT=$2;
+ else
+ LIMIT=1000;
+ fi
+ else
+ echo "Invalid option (-l) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -n|--thread-switching)
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU0="-c $2";
+ shift;
+ else
+ echo "Error: Must specify at least one CPU on which thread has to be spawned"
+ usage
+ fi
+ shift;
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+if [ -z "$FREQ" ]; then
+ echo "Error: Frequency has to be set to either \"big\" or \"little\""
+ usage
+else if [ -z "$CPU_NUM" ]; then
+ echo "Error: Specify the number of CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+fi
+fi
+
+if [ "$PERIODIC_SWITCH" = "y" ]; then
+ run_periodic_switcher
+fi
+
+if [ "$RANDOM_SWITCH" = "y" ]; then
+ if [ -z "$LIMIT" ]; then
+ echo "Error: Specify the Seed Limit for the random switcher [-l 1000]"
+ usage
+ fi
+ run_random_switcher
+fi
+
+run_perf_memtester 10
+
+if ([ "$PERIODIC_SWITCH" = "y" ] || [ "$RANDOM_SWITCH" = "y" ]); then
+ kill_switcher
+fi
+
+if ([ $MEM_STATUS -ne 0 ] || [ $SWITCHER_STATUS -ne 0 ] || [ $PERF_STATUS -ne 0 ]); then
+ echo "Test failed. Abort!!"
+ exit 1
+fi
+
+KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+if [ -n "$KERNEL_ERR" ]; then
+ echo "Kernel OOPS detected. Abort!!"
+ exit 1
+fi
+
+exit 0
diff --git a/run_stress_switcher_tests.sh b/run_stress_switcher_tests.sh
new file mode 100755
index 0000000..bd323f5
--- /dev/null
+++ b/run_stress_switcher_tests.sh
@@ -0,0 +1,677 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Amit Pundir <amit.pundir@linaro.org>
+# Modified-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+usage()
+{
+ echo ""
+ echo "usage: $0 [<option> <argument>] .."
+ echo "Options: -a [Run all tests]"
+ echo " -b [Run all basic module and switcher tests]"
+ echo " -c [Run all cache-coherency tests]"
+ echo " -d [Run all data-corruption tests]"
+ echo " -i [Run all disk-io tests]"
+ echo " -g [Run all governor tests]"
+ echo " -m [Run all memory tests]"
+ echo " -p [Run all perf tests]"
+ echo " -s [Run only switcher tests]"
+ echo " -v [Run all vfp-ffmpeg tests]"
+ echo " -t <specify the test-id(s)> [Run the specified tests]"
+ echo " [ 1 : cache-coherency-a7]"
+ echo " [ 2 : cache-coherency-a15]"
+ echo " [ 3 : cache-coherency-switching]"
+ echo " [ 4 : data-corruption-a7]"
+ echo " [ 5 : data-corruption-a15]"
+ echo " [ 6 : data-corruption-switching]"
+ echo " [ 7 : disk-io-stress-a7]"
+ echo " [ 8 : disk-io-stress-a15]"
+ echo " [ 9 : disk-io-stress-switching]"
+ echo " [10 : mem-stress-a7]"
+ echo " [11 : mem-stress-a15]"
+ echo " [12 : mem-stress-switching]"
+ echo " [13 : bl-basic-tests]"
+ echo " [14 : switcher-tests]"
+ echo " [15 : vfp-ffmpeg-a7]"
+ echo " [16 : vfp-ffmpeg-a15]"
+ echo " [17 : vfp-ffmpeg-switching]"
+ echo " [18 : interactive-governor-test]"
+ echo " [19 : cache-coherency-simultaneous-thread-switching]"
+ echo " [20 : data-corruption-simultaneous-thread-switching]"
+ echo " [21 : disk-io-stress-simultaneous-thread-switching]"
+ echo " [22 : mem-stress-simultaneous-thread-switching]"
+ echo " [23 : vfp-ffmpeg-simultaneous-thread-switching]"
+ echo " [24 : perf-mem-stress-a7]"
+ echo " [25 : perf-mem-stress-a15]"
+ echo " [26 : perf-mem-stress-switching]"
+ echo " [27 : perf-disk-io-stress-a7]"
+ echo " [28 : perf-disk-io-stress-a15]"
+ echo " [29 : perf-disk-io-stress-switching]"
+ echo " [30 : cpu-freq-vs-cluster-freq]"
+ echo ""
+ exit 1
+}
+
+enable_switcher ()
+{
+ echo 1 > /sys/kernel/bL_switcher/active
+ SWITCHER_STATUS=`cat /sys/kernel/bL_switcher/active`
+ if [ $SWITCHER_STATUS -eq 1 ] ; then
+ echo "Switcher enabled"
+ else
+ echo "Failed"
+ echo "cat /sys/kernel/bL_switcher/active != 1"
+ echo "Switcher not supported on this kernel"
+ echo "Test execution aborted"
+ exit 1
+ fi
+}
+
+disable_switcher ()
+{
+ echo 0 > /sys/kernel/bL_switcher/active
+ SWITCHER_STATUS=`cat /sys/kernel/bL_switcher/active`
+ if [ $SWITCHER_STATUS -eq 0 ] ; then
+ echo "Switcher disabled"
+ else
+ echo "Failed"
+ echo "cat /sys/kernel/bL_switcher/active != 0"
+ echo "Switcher not supported on this kernel"
+ echo "Test execution aborted"
+ exit 1
+ fi
+}
+
+check_kernel_oops()
+{
+ KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+ if [ -n "$KERNEL_ERR" ]; then
+ echo "Kernel OOPS. Abort!!"
+ exit 1
+ fi
+}
+
+test_insert_module()
+{
+ echo ""
+
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+ if [ -d $ANDROID_MOD_PATH ]; then
+ MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
+ ONDEMAND_MOD_LOCATION=$UBUNTU_MOD_PATH/cpufreq_ondemand.ko
+ else
+ echo "ERROR: No arm-bl-cpufreq.ko module found"
+ exit 1
+ fi
+ fi
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+ if [ -z "$CPU_FREQ_KM" ]; then
+ if [ -d $ANDROID_MOD_PATH ]; then
+ # on Android none of the module is expected to be loaded as default
+ echo ""
+ elif [ -d $UBUNTU_MOD_PATH ]; then
+ # On Ubuntu below two modules are expected to be loaded as default
+ insmod $MOD_LOCATION
+ insmod $ONDEMAND_MOD_LOCATION
+ fi
+ fi
+}
+
+
+test_remove_module()
+{
+ echo ""
+
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
+
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+ if [ -n "$CPU_FREQ_KM" ]; then
+ if [ -d $ANDROID_MOD_PATH ]; then
+ # On Android remove module if any loaded
+ rmmod arm_bl_cpufreq > /dev/null 2>&1
+ elif [ -d $UBUNTU_MOD_PATH ]; then
+ # On Ubuntu remove modules if any loaded
+ # /etc/init.d/ondemand will load cpufreq_ondemand after
+ # 60 sec from the boot time. if we remove modules right
+ # away. cpufreq_ondemand will load again which we do want.
+ # we will wait here for 90 sec and remove modules
+ # I know this is ugly hack, but left no other option.
+ # TODO: if /etc/init.d/ondemand is not exists in distro
+ # remove sleep
+ sleep 90
+ echo "list of modules present"
+ lsmod
+ echo "remove modules arm_bl_cpufreq & cpufreq_ondemand"
+ rmmod arm_bl_cpufreq > /dev/null 2>&1
+ rmmod cpufreq_ondemand > /dev/null 2>&1
+ fi
+ fi
+}
+
+test_remove_android_module()
+{
+ echo ""
+
+ ANDROID_MOD_PATH=/system/modules
+
+ CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
+ if [ -n "$CPU_FREQ_KM" ]; then
+ if [ -d $ANDROID_MOD_PATH ]; then
+ # On Android remove module if any loaded before exit
+ rmmod arm_bl_cpufreq > /dev/null 2>&1
+ fi
+ fi
+}
+
+test_init()
+{
+ # Remove the module(s).
+ # Let Each Test case will insert whenever it is required
+ echo ""
+ echo "test init"
+ test_remove_module
+}
+
+test_cleanup()
+{
+ echo "test cleanup"
+ # To make default Env Insert modules back on Ubuntu
+ test_insert_module
+ # To make default Env Remove module from Android
+ test_remove_android_module
+ # ensure every thing is perfect
+ check_kernel_oops
+ echo "cleanup done"
+}
+
+trap_handler()
+{
+ echo "Abnormal Exit"
+ test_cleanup
+ echo "cleanup done"
+ exit 1
+}
+
+get_no_of_cpu()
+{
+
+ TASKSET=affinity_tools
+
+ CPU_FAST=
+ CPU_SLOW=
+
+ NO_OF_CPU_FAST=
+ NO_OF_CPU_SLOW=
+ #ARM
+ IMPLEMENTER=0x41
+ #A7
+ PART_SLOW=0xc07
+ #A15
+ PART_FAST=0xc0f
+ eachslow=
+ eachfast=
+ total_no_of_cpu=`ls /sys/devices/system/cpu/cpu*/online | wc -l`
+# echo " total_no_of_cpu= $total_no_of_cpu"
+
+ cpu=0
+ while [ $cpu -lt $total_no_of_cpu ];
+ do
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_SLOW >/dev/null
+ if [ $? == 0 ] ; then
+ eachslow=" -c "
+ CPU_SLOW=$CPU_SLOW$eachslow$cpu
+ fi
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_FAST >/dev/null
+ if [ $? == 0 ] ; then
+ eachfast=" -c "
+ CPU_FAST=$CPU_FAST$eachfast$cpu
+ fi
+ cpu=$((cpu+1))
+ done
+ EACH_CPU="$CPU_SLOW$CPU_FAST"
+# echo " EACH_CPU = $EACH_CPU"
+
+ cpu=0
+ no_of_cpus=" -n"
+ while [ $cpu -lt $total_no_of_cpu ];
+ do
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_SLOW >/dev/null
+ if [ $? == 0 ] ; then
+ spaceslow=" "
+ NO_OF_CPU_SLOW=$NO_OF_CPU_SLOW$spaceslow$cpu
+ fi
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_FAST >/dev/null
+ if [ $? == 0 ] ; then
+ spacefast=" "
+ NO_OF_CPU_FAST=$NO_OF_CPU_FAST$spacefast$cpu
+ fi
+ cpu=$((cpu+1))
+ done
+ NO_OF_CPUS="$no_of_cpus$NO_OF_CPU_SLOW$NO_OF_CPU_FAST"
+# echo "NO_OF_CPUS : $NO_OF_CPUS"
+}
+
+set_userspce_governor()
+{
+ GOVERNOR="userspace"
+ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+ do echo $GOVERNOR > $file
+ done
+ sleep 5;
+}
+
+run_test()
+{
+ TOTAL_TESTS=$((TOTAL_TESTS+1))
+ echo ""
+ echo "Running $1 .."
+ $2
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "$1 : FAIL"
+ FAIL_TESTS=$((FAIL_TESTS+1))
+ else
+ echo "$1 : PASS"
+ PASS_TESTS=$((PASS_TESTS+1))
+ fi
+}
+
+run_all_cache_coherency_tests()
+{
+ echo ""
+ echo "Running all cache-coherency tests .."
+ run_test cache-coherency-a7 "cache-coherency-switcher.sh -f little $EACH_CPU"
+ run_test cache-coherency-a15 "cache-coherency-switcher.sh -f big $EACH_CPU"
+ run_test cache-coherency-switching "cache-coherency-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test cache-coherency-simultaneous-thread-switching "cache-coherency-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+}
+
+run_all_data_corruption_tests()
+{
+ echo ""
+ echo "Running all data-corruption tests .."
+ run_test data-corruption-a7 "data-corruption-switcher.sh -f little $EACH_CPU"
+ run_test data-corruption-a15 "data-corruption-switcher.sh -f big $EACH_CPU"
+ run_test data-corruption-switching "data-corruption-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test data-corruption-simultaneous-thread-switching "data-corruption-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+}
+
+run_all_disk_io_tests()
+{
+ echo ""
+ echo "Running all disk-io tests .."
+ run_test disk-io-stress-a7 "disk-io-stress-switcher.sh -f little $EACH_CPU"
+ run_test disk-io-stress-a15 "disk-io-stress-switcher.sh -f big $EACH_CPU"
+ run_test disk-io-stress-switching "disk-io-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test disk-io-stress-simultaneous-thread-switching "disk-io-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+}
+
+run_all_memory_tests()
+{
+ echo ""
+ echo "Running all memory tests .."
+ run_test mem-stress-a7 "mem-stress-switcher.sh -f little $EACH_CPU"
+ run_test mem-stress-a15 "mem-stress-switcher.sh -f big $EACH_CPU"
+ run_test mem-stress-switching "mem-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test mem-stress-simultaneous-thread-switching "mem-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+}
+
+run_all_switching_tests()
+{
+ echo ""
+ echo "Running all switching tests .."
+ run_test mem-stress-switching "mem-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test data-corruption-switching "data-corruption-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test disk-io-stress-switching "disk-io-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test cache-coherency-switching "cache-coherency-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test vfp-ffmpeg-switching "vfp-ffmpeg-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test cache-coherency-simultaneous-thread-switching "cache-coherency-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ run_test data-corruption-simultaneous-thread-switching "data-corruption-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ run_test disk-io-stress-simultaneous-thread-switching "disk-io-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ run_test mem-stress-simultaneous-thread-switching "mem-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ run_test vfp-ffmpeg-simultaneous-thread-switching "vfp-ffmpeg-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ run_test perf-mem-stress-switching "perf-mem-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test perf-disk-io-stress-switching "perf-disk-io-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+}
+
+run_all_vfp_ffmpeg_tests()
+{
+ echo ""
+ echo "Running all vfp-ffmpeg tests .."
+ run_test vfp-ffmpeg-a7 "vfp-ffmpeg-switcher.sh -f little $EACH_CPU"
+ run_test vfp-ffmpeg-a15 "vfp-ffmpeg-switcher.sh -f big $EACH_CPU"
+ run_test vfp-ffmpeg-switching "vfp-ffmpeg-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test vfp-ffmpeg-simultaneous-thread-switching "vfp-ffmpeg-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+}
+
+run_all_basic_module_switcher_tests()
+{
+ echo ""
+ echo "Running basic module and switcher tests .."
+ run_test bl-basic-tests "run-bl-basic-tests.sh"
+ run_test switcher-tests "switcher-tests.sh"
+ # This test intended for TC2 only
+ if [ "$MODEL" = "V2P-CA15_CA7" ]; then
+ run_test cpu-freq-vs-cluster-freq "cpu_freq_vs_cluster_freq.sh"
+ fi
+}
+
+run_all_governor_tests()
+{
+ echo ""
+ echo "Running governor tests .."
+ run_test interactive-governor-tests "interactive-governor-test.sh"
+}
+
+run_all_perf_tests()
+{
+ echo ""
+ echo "Running perf tests .."
+ run_test perf-mem-stress-a7 "perf-mem-stress-switcher.sh -f little $EACH_CPU -a7 1"
+ run_test perf-mem-stress-a15 "perf-mem-stress-switcher.sh -f big $EACH_CPU -a15 1"
+ run_test perf-mem-stress-switching "perf-mem-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ run_test perf-disk-io-stress-a7 "perf-disk-io-stress-switcher.sh -f little $EACH_CPU -a7 1"
+ run_test perf-disk-io-stress-a15 "perf-disk-io-stress-switcher.sh -f big $EACH_CPU -a15 1"
+ run_test perf-disk-io-stress-switching "perf-disk-io-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+
+}
+
+run_all_tests()
+{
+ echo ""
+ echo "Running all tests .."
+ run_all_basic_module_switcher_tests
+ run_all_memory_tests
+ run_all_disk_io_tests
+ run_all_data_corruption_tests
+ run_all_cache_coherency_tests
+ run_all_vfp_ffmpeg_tests
+# perf tests are deprecated on IKS
+# https://bugs.launchpad.net/linaro-big-little-system/+bug/1183821
+# run_all_perf_tests
+ run_all_governor_tests
+}
+
+summary()
+{
+ echo ""
+ echo "Summary .."
+ echo "Total Tests = $TOTAL_TESTS"
+ echo "Tests Passed = $PASS_TESTS"
+ echo "Tests Failed = $FAIL_TESTS"
+}
+
+if [ -z "$1" ]; then
+ usage
+fi
+
+TOTAL_TESTS=0
+PASS_TESTS=0
+FAIL_TESTS=0
+
+MODEL=`cat /proc/device-tree/model`
+
+# I feel below three signal are good enough to handle
+# trap trap_handler SIGINT SIGTERM SIGTSTP
+trap trap_handler 2 15 20
+
+# enable switcher
+enable_switcher
+
+# get no of cpus online
+get_no_of_cpu
+
+# For TC2
+if [ "$MODEL" = "V2P-CA15_CA7" ]; then
+ # Test setup before real test start
+ set_userspce_governor
+fi
+# For RTSM
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ # Test setup before real test start
+ test_init
+fi
+
+while [ "$1" ]; do
+ case "$1" in
+ -a|--all)
+ run_all_tests
+ ;;
+ -b|--basic-tests)
+ run_all_basic_module_switcher_tests
+ ;;
+ -c|--cache-coherency)
+ run_all_cache_coherency_tests
+ ;;
+ -d|--data-corruption)
+ run_all_data_corruption_tests
+ ;;
+ -i|--disk-io)
+ run_all_disk_io_tests
+ ;;
+ -g|--governor-test)
+ run_all_governor_tests
+ ;;
+ -m|--memory)
+ run_all_memory_tests
+ ;;
+ -p|--perf)
+ run_all_perf_tests
+ ;;
+ -s|--switching)
+ run_all_switching_tests
+ ;;
+ -v|--vfp-ffmpeg)
+ run_all_vfp_ffmpeg_tests
+ ;;
+ -t|--test-id)
+ if [ -z "$2" ]; then
+ echo ""
+ echo "Error: Specify the test-id(s) to run!!"
+ echo " [ 1 : cache-coherency-a7]"
+ echo " [ 2 : cache-coherency-a15]"
+ echo " [ 3 : cache-coherency-switching]"
+ echo " [ 4 : data-corruption-a7]"
+ echo " [ 5 : data-corruption-a15]"
+ echo " [ 6 : data-corruption-switching]"
+ echo " [ 7 : disk-io-stress-a7]"
+ echo " [ 8 : disk-io-stress-a15]"
+ echo " [ 9 : disk-io-stress-switching]"
+ echo " [10 : mem-stress-a7]"
+ echo " [11 : mem-stress-a15]"
+ echo " [12 : mem-stress-switching]"
+ echo " [13 : bl-basic-tests]"
+ echo " [14 : switcher-tests]"
+ echo " [15 : vfp-ffmpeg-a7]"
+ echo " [16 : vfp-ffmpeg-a15]"
+ echo " [17 : vfp-ffmpeg-switching]"
+ echo " [18 : interactive-governor-test]"
+ echo " [19 : cache-coherency-simultaneous-thread-switching]"
+ echo " [20 : data-corruption-simultaneous-thread-switching]"
+ echo " [21 : disk-io-stress-simultaneous-thread-switching]"
+ echo " [22 : mem-stress-simultaneous-thread-switching]"
+ echo " [23 : vfp-ffmpeg-simultaneous-thread-switching]"
+ echo " [24 : perf-mem-stress-a7]"
+ echo " [25 : perf-mem-stress-a15]"
+ echo " [26 : perf-mem-stress-switching]"
+ echo " [27 : perf-disk-io-stress-a7]"
+ echo " [28 : perf-disk-io-stress-a15]"
+ echo " [29 : perf-disk-io-stress-switching]"
+ echo " [30 : cpu-freq-vs-cluster-freq]"
+ echo ""
+ exit 1;
+ fi
+
+ while [ "$2" ]; do
+ case "$2" in
+ 1)
+ echo " run_test cache-coherency-a7 "cache-coherency-switcher.sh -f little $EACH_CPU" "
+ run_test cache-coherency-a7 "cache-coherency-switcher.sh -f little $EACH_CPU"
+ ;;
+ 2)
+ run_test cache-coherency-a15 "cache-coherency-switcher.sh -f big $EACH_CPU"
+ ;;
+ 3)
+ run_test cache-coherency-switching "cache-coherency-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ ;;
+ 4)
+ run_test data-corruption-a7 "data-corruption-switcher.sh -f little $EACH_CPU"
+ ;;
+ 5)
+ run_test data-corruption-a15 "data-corruption-switcher.sh -f big $EACH_CPU"
+ ;;
+ 6)
+ run_test data-corruption-switching "data-corruption-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ ;;
+ 7)
+ run_test disk-io-stress-a7 "disk-io-stress-switcher.sh -f little $EACH_CPU"
+ ;;
+ 8)
+ run_test disk-io-stress-a15 "disk-io-stress-switcher.sh -f big $EACH_CPU"
+ ;;
+ 9)
+ run_test disk-io-stress-switching "disk-io-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ ;;
+ 10)
+ run_test mem-stress-a7 "mem-stress-switcher.sh -f little $EACH_CPU"
+ ;;
+ 11)
+ run_test mem-stress-a15 "mem-stress-switcher.sh -f big $EACH_CPU"
+ ;;
+ 12)
+ run_test mem-stress-switching "mem-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ ;;
+ 13)
+ run_test bl-basic-tests "run-bl-basic-tests.sh"
+ ;;
+ 14)
+ run_test switcher-tests "switcher-tests.sh"
+ ;;
+ 15)
+ run_test vfp-ffmpeg-a7 "vfp-ffmpeg-switcher.sh -f little $EACH_CPU"
+ ;;
+ 16)
+ run_test vfp-ffmpeg-a15 "vfp-ffmpeg-switcher.sh -f big $EACH_CPU"
+ ;;
+ 17)
+ run_test vfp-ffmpeg-switching "vfp-ffmpeg-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ ;;
+ 18)
+ run_test interactive-governor-tests "interactive-governor-test.sh"
+ ;;
+ 19)
+ run_test cache-coherency-simultaneous-thread-switching "cache-coherency-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ ;;
+ 20)
+ run_test data-corruption-simultaneous-thread-switching "data-corruption-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ ;;
+ 21)
+ run_test disk-io-stress-simultaneous-thread-switching "disk-io-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ ;;
+ 22)
+ run_test mem-stress-simultaneous-thread-switching "mem-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ ;;
+ 23)
+ run_test vfp-ffmpeg-simultaneous-thread-switching "vfp-ffmpeg-switcher.sh -f big -c 0 $NO_OF_CPUS -s 100 -S"
+ ;;
+ 24)
+ run_test perf-mem-stress-a7 "perf-mem-stress-switcher.sh -f little $EACH_CPU -a7 1"
+ ;;
+ 25)
+ run_test perf-mem-stress-a15 "perf-mem-stress-switcher.sh -f big $EACH_CPU -a15 1"
+ ;;
+ 26)
+ run_test perf-mem-stress-switching "perf-mem-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ ;;
+ 27)
+ run_test perf-disk-io-stress-a7 "perf-disk-io-stress-switcher.sh -f little $EACH_CPU -a7 1"
+ ;;
+ 28)
+ run_test perf-disk-io-stress-a15 "perf-disk-io-stress-switcher.sh -f big $EACH_CPU -a15 1"
+ ;;
+ 29)
+ run_test perf-disk-io-stress-switching "perf-disk-io-stress-switcher.sh -f big -c 0 $NO_OF_CPUS -r 100 -l 1000"
+ ;;
+ 30)
+ run_test cpu-freq-vs-cluster-freq "cpu_freq_vs_cluster_freq.sh"
+ ;;
+
+ *)
+ echo ""
+ echo "Error: Unknown test-id \"$2\""
+ echo " Specify the correct test(s) to run!!"
+ echo " [ 1 : cache-coherency-a7]"
+ echo " [ 2 : cache-coherency-a15]"
+ echo " [ 3 : cache-coherency-switching]"
+ echo " [ 4 : data-corruption-a7]"
+ echo " [ 5 : data-corruption-a15]"
+ echo " [ 6 : data-corruption-switching]"
+ echo " [ 7 : disk-io-stress-a7]"
+ echo " [ 8 : disk-io-stress-a15]"
+ echo " [ 9 : disk-io-stress-switching]"
+ echo " [10 : mem-stress-a7]"
+ echo " [11 : mem-stress-a15]"
+ echo " [12 : mem-stress-switching]"
+ echo " [13 : bl-basic-tests]"
+ echo " [14 : switcher-tests]"
+ echo " [15 : vfp-ffmpeg-a7]"
+ echo " [16 : vfp-ffmpeg-a15]"
+ echo " [17 : vfp-ffmpeg-switching]"
+ echo " [18 : interactive-governor-test]"
+ echo " [19 : cache-coherency-simultaneous-thread-switching]"
+ echo " [20 : data-corruption-simultaneous-thread-switching]"
+ echo " [21 : disk-io-stress-simultaneous-thread-switching]"
+ echo " [22 : mem-stress-simultaneous-thread-switching]"
+ echo " [23 : vfp-ffmpeg-simultaneous-thread-switching]"
+ echo " [24 : perf-mem-stress-a7]"
+ echo " [25 : perf-mem-stress-a15]"
+ echo " [26 : perf-mem-stress-switching]"
+ echo " [27 : perf-disk-io-stress-a7]"
+ echo " [28 : perf-disk-io-stress-a15]"
+ echo " [29 : perf-disk-io-stress-switching]"
+ echo " [30 : cpu-freq-vs-cluster-freq]"
+ echo ""
+ exit 1;
+ ;;
+ esac
+ shift;
+ done
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+# For RTSM
+if [ "$MODEL" = "RTSM_VE_CortexA15x4-A7x4" ]; then
+ # Test cleanup before exit
+ test_cleanup
+fi
+
+# disable switcher
+disable_switcher
+
+summary
+
+exit 0
diff --git a/vfp-ffmpeg-switcher/vfp-ffmpeg-switcher.sh b/vfp-ffmpeg-switcher/vfp-ffmpeg-switcher.sh
new file mode 100755
index 0000000..350a50a
--- /dev/null
+++ b/vfp-ffmpeg-switcher/vfp-ffmpeg-switcher.sh
@@ -0,0 +1,474 @@
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+# Assumes package ffmpeg is installed
+
+usage()
+{
+ echo ""
+ echo "usage: $0 [<option> <argument>] .."
+ echo ""
+ echo "Options: -f <operating frequency> [big/little; Default: big]"
+ echo " -c <operate on this cpu> [this option can be specified multiple times]"
+ echo " -d <take this cpu offline>"
+ echo " -e <bring this cpu online>"
+ echo " -i <number of iterations> [Default: 1]"
+ echo " -p <input file> [Default: /data/samples/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG]"
+ echo " -s <periodic switching interval in msec> [Default: 50]"
+ echo " -r <random switching seed> [Default: 100]"
+ echo " -l <random switching seed limit> [Default: 1000]"
+ echo " -n <threads to be executed on specific cpus>"
+ echo " -S single-sync Sequential half transition (e.g.: big->barrier->little->barrier)"
+ echo ""
+ echo "Example of periodic switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -s 50"
+ echo "Example of random switching: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -r 100 -l 1000"
+ echo "Example of periodic switching while spawning threads on cpu0 and cpu3: $0 -f big -c 0 -c 1 ... -c $large_cpu_number -n 0 ... $large_cpu_number -s 50"
+ echo "Example of simultaneous thread while spawning threads on all cpus: $0 -f big -c 0 -n 0 ... $large_cpu_number -s 100 -S"
+ exit 1
+}
+
+VPF_OGG_STATUS=0;
+SWITCHER_STATUS=0;
+
+total_no_of_cpu=`ls /sys/devices/system/cpu/cpu*/online | wc -l`
+large_cpu_number=$((total_no_of_cpu-1))
+
+TASKSET=affinity_tools
+
+CPU_FAST=
+CPU_SLOW=
+
+#ARM
+IMPLEMENTER=0x41
+#A7
+PART_SLOW=0xc07
+#A15
+PART_FAST=0xc0f
+eachslow=
+eachfast=
+EACH_CPU=
+
+get_no_of_cpus ()
+{
+ cpu=0
+ while [ $cpu -lt $total_no_of_cpu ];
+ do
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_SLOW >/dev/null
+ if [ $? == 0 ] ; then
+ eachslow=" -c "
+ CPU_SLOW=$CPU_SLOW$eachslow$cpu
+ fi
+ $TASKSET -part $cpu,$IMPLEMENTER,$PART_FAST >/dev/null
+ if [ $? == 0 ] ; then
+ eachfast=" -c "
+ CPU_FAST=$CPU_FAST$eachfast$cpu
+ fi
+ cpu=$((cpu+1))
+ done
+ EACH_CPU="$CPU_SLOW$CPU_FAST"
+}
+
+switch()
+{
+ if [ "$FREQ" -eq 0 ]; then
+ boot_a15
+ else if [ "$FREQ" -eq 1 ]; then
+ boot_a7
+ else
+ echo "Error: Unknown Operating frequency. Has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+}
+
+boot_a15()
+{
+ echo ""
+ echo "Switching to big mode if not already in."
+ boot-a15.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a15 failed. Abort!!"
+ exit 1
+ fi
+}
+
+boot_a7()
+{
+ echo ""
+ echo "Switching to little mode if not already in."
+ boot-a7.sh -c $CPU_NUM
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "boot-a7 failed. Abort!!"
+ exit 1
+ fi
+}
+
+disable_cpu()
+{
+ echo ""
+ echo "Taking CPU$DISABLE_CPU offline .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$DISABLE_CPU/online`
+ if [ $STATUS -eq 1 ]; then
+ echo 0 > /sys/devices/system/cpu/cpu$DISABLE_CPU/online
+ else
+ echo "CPU$DISABLE_CPU already in offline mode."
+ fi
+}
+
+enable_cpu()
+{
+ echo ""
+ echo "Bringing CPU$ENABLE_CPU online .."
+ STATUS=`cat /sys/devices/system/cpu/cpu$ENABLE_CPU/online`
+ if [ $STATUS -eq 0 ]; then
+ echo 1 > /sys/devices/system/cpu/cpu$ENABLE_CPU/online
+ else
+ echo "CPU$ENABLE_CPU already in online mode."
+ fi
+}
+
+run_vfp_ffmpeg_ogg()
+{
+ # Set input file location for vfp-ffmpeg.sh
+ if [ -z "$FILE" ]; then
+ if [ -r /data/boxes/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG ]; then
+ FILE=/data/boxes/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG;
+ elif [ -r /usr/share/testdata/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG ]; then
+ FILE=/usr/share/testdata/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG;
+ fi
+ fi
+ if [ -z "$ITR" ]; then
+ ITR=1;
+ fi
+
+ echo ""
+ echo "Running vfp-ffmpeg.sh "$FILE" "$ITR""
+ vfp-ffmpeg.sh $FILE $ITR
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo " vfp-ffmpeg.sh failed. Abort!!"
+ VPF_OGG_STATUS=$ERR_CODE;
+ return 1
+ else
+ echo "vfp-ffmpeg.sh finished successfully"
+ return 0
+ fi
+}
+
+run_periodic_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE periodic switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR &"
+ bl-agitator -n $EACH_CPU -s $INTR &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE periodic switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+run_random_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE random switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &"
+ bl-agitator -n $EACH_CPU -r $SEED -l $LIMIT &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE random switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+simultaneous_thread_switcher()
+{
+ echo ""
+ echo "Starting bigLITTLE simultaneous thread switcher in the background"
+ if [ -z "$THREAD_CPU0" ]; then
+ bl-agitator -s $INTR &
+ BL_AGITATOR_PID=$!
+ else
+ echo "spawning thread(s) on specified cpu(s)"
+ echo "bl-agitator -n $EACH_CPU -s $INTR -S &"
+ bl-agitator -n $EACH_CPU -s $INTR -S &
+ BL_AGITATOR_PID=$!
+ fi
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "bigLITTLE simultaneous thread switcher failed. Abort!!"
+ SWITCHER_STATUS=$ERR_CODE;
+ return 1
+ else
+ return 0
+ fi
+}
+
+kill_switcher()
+{
+ echo ""
+ ANDROID_MOD_PATH=/system/modules
+ UBUNTU_MOD_PATH=/lib/modules
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ echo "Kill bigLITTLE switcher BL_AGITATOR_PID $BL_AGITATOR_PID"
+ echo "PID_BL_CHECK= $PID_BL_CHECK"
+
+ if [ -z "$PID_BL_CHECK" ]; then
+ echo "bigLITTLE switcher not running. Report Error!!"
+ exit 1
+ else
+ # done with bl-agitator. Kill the process
+ echo "sending SIGTERM BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill $BL_AGITATOR_PID
+ if [ -d $ANDROID_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $2}'`
+ else if [ -d $UBUNTU_MOD_PATH ]; then
+ PID_BL_CHECK_AGAIN=`ps ax | grep "$BL_AGITATOR_PID" | grep "bl-agitator" | awk '{print $1}'`
+ else
+ echo "ERROR: Unexpected Environment "
+ exit 1
+ fi
+ fi
+ if [ -n "$PID_BL_CHECK_AGAIN" ]; then
+ #if the above kill is not successfull. kill forcefully
+ echo "sending SIGKILL BL_AGITATOR_PID $BL_AGITATOR_PID"
+ kill -9 $BL_AGITATOR_PID > /dev/null 2>&1
+ fi
+ fi
+}
+
+if [ -z "$1" ]; then
+ usage
+fi
+
+get_no_of_cpus
+
+while [ "$1" ]; do
+ case "$1" in
+ -f|--frequency)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ if [ "$2" = "big" ]; then
+ FREQ=0;
+ shift;
+ else if [ "$2" = "little" ]; then
+ FREQ=1;
+ shift;
+ else
+ echo "Error: Operating frequency has to be set to either \"big\" or \"little\""
+ usage
+ fi
+ fi
+ ;;
+ -c|--cpu-num)
+ if [ -z "$2" ]; then
+ echo "Error: Specify the CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+ fi
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ CPU_NUM=$2;
+ if [ -z "$FREQ" ]; then
+ echo "Error: Specify the operating frequency [big/little]"
+ usage
+ fi
+ switch
+ shift;
+ else
+ usage
+ fi
+ ;;
+ -d|--disable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ DISABLE_CPU=$2;
+ disable_cpu
+ shift;
+ fi
+ ;;
+ -e|--enable-cpu)
+ if [ $(echo "$2" | grep -E "^[1-3]+$") ]; then
+ ENABLE_CPU=$2;
+ enable_cpu
+ shift;
+ fi
+ ;;
+ -i|--iterations)
+ if [ "$2" -gt 0 ]; then
+ ITR=$2;
+ shift;
+ fi
+ ;;
+ -p|--input-file)
+ if [ -e "$2" ]; then
+ FILE=$2;
+ shift;
+ fi
+ ;;
+ -s|--periodic-switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ PERIODIC_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ INTR=$2;
+ else
+ INTR=50;
+ fi
+ else
+ echo "Invalid option (-s) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Random switching mode"
+ fi
+ shift;
+ ;;
+ -r|--random-switching)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ RANDOM_SWITCH=y;
+ if [ "$2" -gt 0 ]; then
+ SEED=$2;
+ else
+ SEED=100;
+ fi
+ else
+ echo "Invalid option (-r) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -l|--seed-limit)
+ if [ -z "$PERIODIC_SWITCH" ]; then
+ if [ -z "$SEED" ]; then
+ echo "Error: Specify the Seed for the random switcher [-r 100]"
+ usage
+ fi
+ if [ "$2" -gt 0 ]; then
+ LIMIT=$2;
+ else
+ LIMIT=1000;
+ fi
+ else
+ echo "Invalid option (-l) !!"
+ echo "Can't do random and periodic switchings simultaneously"
+ echo "Set to Periodic switching mode"
+ fi
+ shift;
+ ;;
+ -n|--thread-switching)
+ if [ $(echo "$2" | grep -E "^[0-$large_cpu_number]+$") ]; then
+ THREAD_CPU0="-c $2";
+ shift;
+ else
+ echo "Error: Must specify at least one CPU on which thread has to be spawned"
+ usage
+ fi
+ shift;
+ ;;
+ -S|--simultaneous_thread_switching)
+ if [ -z "$RANDOM_SWITCH" ]; then
+ SIMULTANEOUS_THREAD_SWITCH=y;
+ else
+ echo "Invalid option (-S) !!"
+ echo "Can't do random and simultaneous thread switching at a time"
+ echo "Set to Random switching mode"
+ fi
+ ;;
+ -h | --help | *)
+ usage
+ ;;
+ esac
+ shift;
+done
+
+if [ -z "$FREQ" ]; then
+ echo "Error: Frequency has to be set to either \"big\" or \"little\""
+ usage
+else if [ -z "$CPU_NUM" ]; then
+ echo "Error: Specify the number of CPU core (0-$large_cpu_number) to be switched to the desired frequency"
+ usage
+fi
+fi
+
+if [ "$PERIODIC_SWITCH" = "y" ]; then
+ if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ echo ""
+ else
+ run_periodic_switcher
+ fi
+fi
+
+if [ "$RANDOM_SWITCH" = "y" ]; then
+ if [ -z "$LIMIT" ]; then
+ echo "Error: Specify the Seed Limit for the random switcher [-l 1000]"
+ usage
+ fi
+ run_random_switcher
+fi
+
+if [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]; then
+ simultaneous_thread_switcher
+ cluster-status.sh $BL_AGITATOR_PID &
+fi
+
+run_vfp_ffmpeg_ogg
+
+if ([ "$PERIODIC_SWITCH" = "y" ] || [ "$RANDOM_SWITCH" = "y" ] || [ "$SIMULTANEOUS_THREAD_SWITCH" = "y" ]); then
+ kill_switcher
+fi
+
+if ([ $VPF_OGG_STATUS -ne 0 ] || [ $SWITCHER_STATUS -ne 0 ]); then
+ echo "Test failed. Abort!!"
+ exit 1
+fi
+
+KERNEL_ERR=`dmesg | grep "Unable to handle kernel "`
+if [ -n "$KERNEL_ERR" ]; then
+ echo "Kernel OOPS detected. Abort!!"
+ exit 1
+fi
+
+exit 0
diff --git a/vfp-ffmpeg/inputfiles/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG b/vfp-ffmpeg/inputfiles/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG
new file mode 100644
index 0000000..9c0bb60
--- /dev/null
+++ b/vfp-ffmpeg/inputfiles/big_buck_bunny_VORBIS_2Channel_48k_128K_short.OGG
Binary files differ
diff --git a/vfp-ffmpeg/vfp-ffmpeg.sh b/vfp-ffmpeg/vfp-ffmpeg.sh
new file mode 100755
index 0000000..238746f
--- /dev/null
+++ b/vfp-ffmpeg/vfp-ffmpeg.sh
@@ -0,0 +1,107 @@
+#
+# Copyright (C) 2012, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+
+# Assumes package ffmpeg is installed
+
+set -e
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 <Inputfile (ogg)> [iterations]"
+ exit 1
+fi
+
+echo
+echo "*** vfp ffmpeg Test ***"
+
+if [ ! -e "$1" ]; then
+ echo "File $1 does not exist!"
+ exit 1
+fi
+
+if [ -n "$2" ]; then
+ if [ $(echo "$2" | grep -E "^[0-9]+$") ]; then
+ iterations=$2
+ else
+ echo "<iterations> must be a valid number; setting it to 1"
+ iterations=1
+ fi
+else
+ iterations=1
+fi
+# set Location for tmp files
+if [ -z "$LOC" ]; then
+ if [ -r /data/boxes ]; then
+ LOC=/data/boxes;
+ elif [ -r /usr/share/testdata ]; then
+ LOC=/usr/share/testdata;
+ fi
+fi
+
+FILE_NAME="output_file"
+ERR_CODE=0
+
+i=1
+while test $i -lt $((iterations+1)) ; do
+ echo
+ echo "Iteration $i/$iterations:"
+
+ ffmpeg -i $1 -map 0 $LOC/$FILE_NAME"_"$i.wav > /dev/null 2>&1
+ ERR_CODE=$?
+ if [ $ERR_CODE -ne 0 ]; then
+ echo "ffmpeg not able to create FILE_NAME_$i.wav"
+ echo "vfp ffmpeg failed. Abort!!"
+ exit 1
+ fi
+
+ i=$((i+1))
+done
+
+i=1
+while test $i -lt $((iterations+1)) ; do
+ echo
+ MD5SUM_CHECK=`md5sum $LOC/$FILE_NAME"_"$i.wav | cut -f 1 -d ' '`
+ if [ -n $MD5SUM_CHECK ]; then
+ if [ $i = 1 ]; then
+ TEMP_CHECK=$MD5SUM_CHECK
+ echo "vfp ffmpeg test: $MD5SUM_CHECK: PASS"
+ elif [ $TEMP_CHECK = $MD5SUM_CHECK ]; then
+ TEMP_CHECK=$MD5SUM_CHECK
+ echo "vfp ffmpeg test: $MD5SUM_CHECK: PASS"
+ else
+ echo "vfp ffmpeg test: $MD5SUM_CHECK: FAIL"
+ exit 1
+ fi
+ else
+ echo "md5sum not found $LOC/$FILE_NAME"_"$i.wav"
+ echo "vfp ffmpeg test: $MD5SUM_CHECK: FAIL"
+ exit 1
+ fi
+
+ i=$((i+1))
+done
+
+i=1
+while test $i -lt $((iterations+1)) ; do
+ rm $LOC/$FILE_NAME"_"$i.wav
+ i=$((i+1))
+done
+
+echo
+echo "*** vfp ffmpeg Test completed successfully ***"
+exit 0