xref: /linux/tools/perf/tests/shell/stat_all_metricgroups.sh (revision 24168c5e6dfbdd5b414f048f47f75d64533296ca)
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