summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2015-03-04 13:59:08 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2015-03-07 16:16:20 +0800
commitad2dac846b9d9372b03817538f4da71cfbf94c2d (patch)
tree3d1ce38ad8be8369f08b2d19999cf2b5306eac6d
parent5b8e88a857ed6f5433aca50fb25846634655a95e (diff)
add test for bionic-benchmarks
Change-Id: I5bb16aab534a0fab1155dc9f8da0fa11de1ba31d Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--android/bionic-benchmark.yaml19
-rwxr-xr-xandroid/scripts/bionic-benchmarks.sh75
2 files changed, 94 insertions, 0 deletions
diff --git a/android/bionic-benchmark.yaml b/android/bionic-benchmark.yaml
new file mode 100644
index 0000000..ac8b135
--- /dev/null
+++ b/android/bionic-benchmark.yaml
@@ -0,0 +1,19 @@
+metadata:
+ name: bionic-benchmarks-with-units
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "collect the bionic-benchmarks data and try to analyse"
+ maintainer:
+ - yongqin.liu@linaro.org
+ os:
+ - android
+ scope:
+ - performance
+ devices:
+ - juno
+
+params:
+ LOOP_TIMES: 1
+
+run:
+ steps:
+ - ./android/scripts/bionic-benchmarks.sh $LOOP_TIMES
diff --git a/android/scripts/bionic-benchmarks.sh b/android/scripts/bionic-benchmarks.sh
new file mode 100755
index 0000000..9839179
--- /dev/null
+++ b/android/scripts/bionic-benchmarks.sh
@@ -0,0 +1,75 @@
+#!/system/bin/sh
+
+loop_times=$1
+if [ -z "${loop_times}" ]; then
+ loop_times=12
+fi
+raw_data="/data/local/tmp/bionic-benchmarks-raw.csv"
+rm -fr ${raw_data}
+
+add_lava_result_entry(){
+ local cmd="lava-test-case"
+ if [ -n "$(which $cmd)" ];then
+ $cmd "$@"
+ else
+ echo "$cmd $@"
+ fi
+}
+
+test_bionic_benchmark(){
+ local arch=$1 && shift
+ if [ "X$arch" != "X32" ] && [ "X$arch" != "X64" ]; then
+ echo "The specified $arch is not specified!"
+ return
+ fi
+ local excluded_test=$1 && shift
+ local cmd="bionic-benchmarks${arch}"
+ if [ -n "$(which ${cmd})" ]; then
+ for line in $(${cmd} --help 2>&1|grep BM_); do
+ if [ -n "$excluded_test" ]; then
+ if echo "${excluded_test}"|grep -q ${line}; then
+ echo "${arch}_${line} skip"
+ add_lava_result_entry "${arch}_${line}" "--result" "skip"
+ continue
+ fi
+ fi
+ echo "--------------start $line--------"
+ local hasResult=false
+ for res_line in $(${cmd} ${line}|grep "BM_"|tr -s ' '|tr ' ' ','); do
+ echo "${arch}_$line pass"
+ add_lava_result_entry "${arch}_${line}" "--result" "pass"
+ local key=$(echo $res_line|cut -d, -f1|tr '/' '_')
+ local iterations=$(echo $res_line|cut -d, -f2)
+ local ns_time=$(echo $res_line|cut -d, -f3)
+ local throughput=$(echo $res_line|cut -d, -f4)
+ local throughput_units=$(echo $res_line|cut -d, -f5)
+ echo "${arch}_${key}_time pass $ns_time ns/op"
+ add_lava_result_entry "${arch}_${key}_time" "--result" "pass" '--measurement' "${ns_time}" '--units' "ns/op"
+ echo "${arch}_${key}_time,${ns_time}">>${raw_data}
+ if [ -n "${throughput_units}" ];then
+ echo "${arch}_${key}_throught pass ${throughput} ${throughput_units}"
+ add_lava_result_entry "${arch}_${key}_throught" "--result" "pass" '--measurement' "${throughput}" '--units' "${throughput_units}"
+ echo "${arch}_${key}_throught,${throughput}">>${raw_data}
+ fi
+ hasResult=true
+ done
+ if ! $hasResult; then
+ echo "${arch}_$line fail"
+ add_lava_result_entry "${arch}_${line}" "--result" "fail"
+ fi
+ echo "--------------finished $line--------"
+ done
+ fi
+}
+
+loop_index=0
+while [ ${loop_index} -lt ${loop_times} ]; do
+ test_bionic_benchmark "64" "BM_property_serial"
+ test_bionic_benchmark "32" "BM_property_serial BM_property_read"
+ loop_index=$((loop_index + 1))
+done
+
+attach_cmd="lava-test-run-attach"
+if [ -n "$(which ${attach_cmd})" ] && [ -f "${raw_data}" ]; then
+ ${attach_cmd} ${raw_data} text/plain
+fi