Commit 0ddce121 authored by Ian Rogers's avatar Ian Rogers Committed by Namhyung Kim

perf test: Avoid system wide when not privileged

Switch the test program to sleep that makes more sense for system wide
events. Only enable system wide when root or not paranoid. This avoids
failures under some testing conditions like ARM cloud.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20230930060206.2353141-1-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent be7a4caa
......@@ -4,9 +4,21 @@
set -e
for m in $(perf list --raw-dump metricgroups); do
function ParanoidAndNotRoot()
{
[ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]
}
system_wide_flag="-a"
if ParanoidAndNotRoot 0
then
system_wide_flag=""
fi
for m in $(perf list --raw-dump metricgroups)
do
echo "Testing $m"
perf stat -M "$m" -a true
perf stat -M "$m" $system_wide_flag sleep 0.01
done
exit 0
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