diff options
-rwxr-xr-x | common/scripts/perf-mmaptest.sh | 69 | ||||
-rw-r--r-- | ubuntu/perf-mmap.yaml | 34 |
2 files changed, 103 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}; diff --git a/ubuntu/perf-mmap.yaml b/ubuntu/perf-mmap.yaml new file mode 100644 index 0000000..391dc6b --- /dev/null +++ b/ubuntu/perf-mmap.yaml @@ -0,0 +1,34 @@ +metadata: + name: perf-mmap-test + format: "Lava-Test-Shell Test Definition 1.0" + description: "Perf-mmap-test is testsuite for showing benchmarks for accessing perf hw counters from userspace with traditional way by using read syscall, and mmap way" + maintainer: + - yogesh.tillu@linaro.org + os: + - ubuntu + scope: + - performance + devices: + - juno + +install: + deps: + - build-essential + - linux-libc-dev + git-repos: + - url: https://git.linaro.org/qa/perfcounter_access_test.git + steps: + - "cd perfcounter_access_test" + - "make install MAX_DELAY=1" + +params: + BUSYLOOP: 64 + COUNTER: "0 1 2 3 5 9" + CPU: "0 1" + +run: + steps: + - 'for core in $CPU; do \' + - 'echo "Tests Executing on CPU $core"; \' + - 'taskset -c $core ./common/scripts/perf-mmaptest.sh ${BUSYLOOP} "$COUNTER" $core; \' + - 'done' |