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