Commit 0996e674 authored by Swapnil Sapkal's avatar Swapnil Sapkal Committed by Shuah Khan

selftests/amd-pstate: Added option to provide perf binary path

In selftests/amd-pstate, distro `perf` is used to capture `perf stat`
while running microbenchmarks. Distro `perf` is not working with
upstream kernel. Fix this by providing an option to give the perf
binary path.
Reviewed-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarSwapnil Sapkal <swapnil.sapkal@amd.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 27aabb2c
...@@ -88,7 +88,7 @@ run_gitsource() ...@@ -88,7 +88,7 @@ run_gitsource()
BACKUP_DIR=$(pwd) BACKUP_DIR=$(pwd)
pushd $BACKUP_DIR > /dev/null 2>&1 pushd $BACKUP_DIR > /dev/null 2>&1
cd $SCRIPTDIR/$git_name cd $SCRIPTDIR/$git_name
perf stat -a --per-socket -I 1000 -e power/energy-pkg/ /usr/bin/time -o $BACKUP_DIR/$OUTFILE_GIT.time-gitsource-$1-$2.log make test -j$MAKE_CPUS > $BACKUP_DIR/$OUTFILE_GIT-perf-$1-$2.log 2>&1 $PERF stat -a --per-socket -I 1000 -e power/energy-pkg/ /usr/bin/time -o $BACKUP_DIR/$OUTFILE_GIT.time-gitsource-$1-$2.log make test -j$MAKE_CPUS > $BACKUP_DIR/$OUTFILE_GIT-perf-$1-$2.log 2>&1
popd > /dev/null 2>&1 popd > /dev/null 2>&1
for job in `jobs -p` for job in `jobs -p`
......
...@@ -25,6 +25,7 @@ OUTFILE=selftest ...@@ -25,6 +25,7 @@ OUTFILE=selftest
OUTFILE_TBENCH="$OUTFILE.tbench" OUTFILE_TBENCH="$OUTFILE.tbench"
OUTFILE_GIT="$OUTFILE.gitsource" OUTFILE_GIT="$OUTFILE.gitsource"
PERF=/usr/bin/perf
SYSFS= SYSFS=
CPUROOT= CPUROOT=
CPUFREQROOT= CPUFREQROOT=
...@@ -154,6 +155,7 @@ help() ...@@ -154,6 +155,7 @@ help()
[-p <tbench process number>] [-p <tbench process number>]
[-l <loop times for tbench>] [-l <loop times for tbench>]
[-i <amd tracer interval>] [-i <amd tracer interval>]
[-b <perf binary>]
[-m <comparative test: acpi-cpufreq>] [-m <comparative test: acpi-cpufreq>]
\n" \n"
exit 2 exit 2
...@@ -161,7 +163,7 @@ help() ...@@ -161,7 +163,7 @@ help()
parse_arguments() parse_arguments()
{ {
while getopts ho:c:t:p:l:i:m: arg while getopts ho:c:t:p:l:i:b:m: arg
do do
case $arg in case $arg in
h) # --help h) # --help
...@@ -192,6 +194,10 @@ parse_arguments() ...@@ -192,6 +194,10 @@ parse_arguments()
TRACER_INTERVAL=$OPTARG TRACER_INTERVAL=$OPTARG
;; ;;
b) # --perf-binary
PERF=`realpath $OPTARG`
;;
m) # --comparative-test m) # --comparative-test
COMPARATIVE_TEST=$OPTARG COMPARATIVE_TEST=$OPTARG
;; ;;
...@@ -205,8 +211,8 @@ parse_arguments() ...@@ -205,8 +211,8 @@ parse_arguments()
command_perf() command_perf()
{ {
if ! command -v perf > /dev/null; then if ! $PERF -v; then
echo $msg please install perf. >&2 echo $msg please install perf or provide perf binary path as argument >&2
exit $ksft_skip exit $ksft_skip
fi fi
} }
......
...@@ -68,7 +68,7 @@ run_tbench() ...@@ -68,7 +68,7 @@ run_tbench()
printf "Test tbench for $1 #$2 time_limit: $TIME_LIMIT procs_num: $PROCESS_NUM\n" printf "Test tbench for $1 #$2 time_limit: $TIME_LIMIT procs_num: $PROCESS_NUM\n"
tbench_srv > /dev/null 2>&1 & tbench_srv > /dev/null 2>&1 &
perf stat -a --per-socket -I 1000 -e power/energy-pkg/ tbench -t $TIME_LIMIT $PROCESS_NUM > $OUTFILE_TBENCH-perf-$1-$2.log 2>&1 $PERF stat -a --per-socket -I 1000 -e power/energy-pkg/ tbench -t $TIME_LIMIT $PROCESS_NUM > $OUTFILE_TBENCH-perf-$1-$2.log 2>&1
pid=`pidof tbench_srv` pid=`pidof tbench_srv`
kill $pid kill $pid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment