summaryrefslogtreecommitdiff
path: root/tools/perf/tests/shell/stat_all_metricgroups.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/tests/shell/stat_all_metricgroups.sh')
-rwxr-xr-xtools/perf/tests/shell/stat_all_metricgroups.sh16
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/perf/tests/shell/stat_all_metricgroups.sh b/tools/perf/tests/shell/stat_all_metricgroups.sh
index cb35e488809a..55ef9c9ded2d 100755
--- a/tools/perf/tests/shell/stat_all_metricgroups.sh
+++ b/tools/perf/tests/shell/stat_all_metricgroups.sh
@@ -4,9 +4,21 @@
set -e
-for m in $(perf list --raw-dump metricgroups); do
+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