summaryrefslogtreecommitdiff
path: root/common/scripts
diff options
context:
space:
mode:
authorYogesh Tillu <yogesh.tillu@linaro.org>2015-08-11 18:26:32 +0530
committerYogesh Tillu <yogesh.tillu@linaro.org>2015-09-24 16:46:50 +0530
commit33d4e18e2daff630629aa9e63154182727be4dd7 (patch)
tree876d2fb78692f6a0c19cef518129b6d9deefe6c8 /common/scripts
parent8eb85db968f297f2ec0e212340fbb8d1722f28e6 (diff)
perf-mmap-tests: Added CI test codebase for perf-mmap.
perf-mmap testsuite is consist of two test cases. perf_ev_open: perf hw counters are access/benchmark with open/read syscall. perf_rc_mmap: perf hw counters are access/benchmark with open/mmap way. Change-Id: Ic37a73938aec2d08a3758c3440a9b08978cef507 Signed-off-by: Yogesh Tillu <yogesh.tillu@linaro.org>
Diffstat (limited to 'common/scripts')
-rwxr-xr-xcommon/scripts/perf-mmaptest.sh69
1 files changed, 69 insertions, 0 deletions
diff --git a/common/scripts/perf-mmaptest.sh b/common/scripts/perf-mmaptest.sh
new file mode 100755
index 0000000..1cfd899
--- /dev/null
+++ b/common/scripts/perf-mmaptest.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# Variables for loop, counter, cpu's
+BUSYLOOP=${1}
+COUNTER=${2}
+CPU=${3}
+Max=1500000
+Avg=1500
+tmp_avg=0
+tmp_max=0
+
+# Check for binaries availability
+ev_path=$(which perf_ev_open)
+mmap_path=$(which perf_rc_mmap)
+
+if [ ! -f "$ev_path" ] || [ ! -f "$mmap_path" ]; then
+ echo "Error! the command 'perf tests' doesn't exist!"
+ lava-test-case perf-mmaptest --result fail
+ exit 1
+fi
+
+log_file="perfmmap.log";
+# Run tests on each cpu
+for cnt in ${COUNTER};
+do
+ perf_ev_open -n${BUSYLOOP} -c${cnt} >> ${log_file};
+ perf_rc_mmap -n${BUSYLOOP} -c${cnt} >> ${log_file};
+done;
+
+cat ${log_file};
+#function to calculate max
+max(){
+if [ ${1} ] && [ ${1} -gt ${2} ]; then
+ return ${1}
+else
+ return ${2}
+fi
+}
+
+#Parsing file for result
+lava-test-run-attach ${log_file};
+while read line;
+do
+ avg=$(echo ${line}|grep -o "avg delay\[cpucycles\]=[0-9]*" | grep -o "[0-9]*")
+ max=$(echo ${line}|grep -o "max delay\[cpucycles\]=[0-9]*" | grep -o "[0-9]*")
+ max ${avg} ${tmp_avg}
+ tmp_avg="$?"
+ if [ ! -z "${max}" ]; then
+ max ${max} ${tmp_max}
+ fi
+ tmp_max="$?"
+done < ${log_file}
+
+avg_result="fail"
+
+if [ ${Avg} -gt ${tmp_avg} ]; then
+ avg_result="pass"
+fi
+
+lava-test-case perfmmap-cpu${CPU}-Avg --result ${avg_result} --units cpucycles --measurement ${tmp_avg}
+
+if [ ${tmp_max} -gt 0 ]; then
+ avg_result="fail"
+ if [ ${Max} -gt ${tmp_max} ]; then
+ avg_result="pass"
+ fi
+ lava-test-case perfmmap-cpu${CPU}-Max --result ${avg_result} --units cpucycles --measurement ${tmp_max}
+fi
+rm -f ${log_file};