25 lines · bash
1#!/bin/sh2# perf all metricgroups test3# SPDX-License-Identifier: GPL-2.04 5set -e6 7ParanoidAndNotRoot()8{9 [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]10}11 12system_wide_flag="-a"13if ParanoidAndNotRoot 014then15 system_wide_flag=""16fi17 18for m in $(perf list --raw-dump metricgroups)19do20 echo "Testing $m"21 perf stat -M "$m" $system_wide_flag sleep 0.0122done23 24exit 025