xref: /linux/tools/perf/tests/shell/stat_all_metricgroups.sh (revision 5027ec19f1049a07df5b0a37b1f462514cf2724b)
1#!/bin/sh
2# perf all metricgroups test
3# SPDX-License-Identifier: GPL-2.0
4
5set -e
6
7ParanoidAndNotRoot()
8{
9  [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]
10}
11
12system_wide_flag="-a"
13if ParanoidAndNotRoot 0
14then
15  system_wide_flag=""
16fi
17
18for m in $(perf list --raw-dump metricgroups)
19do
20  echo "Testing $m"
21  perf stat -M "$m" $system_wide_flag sleep 0.01
22done
23
24exit 0
25