#!/bin/sh # test perf stat output combinations with --metric-only # output has to be manually verified [ ! -d obj-perf ] && cd .. set -x PERF=${PERF:-./obj-perf/perf} run() { $PERF stat -a "$@" sleep 2 } runprog() { $PERF stat "$@" true } run run -x, run --per-core run --per-socket run -e cycles,instructions run -dddd # topdown # instructions run -I 500 run -I 500 --per-core run -I 500 --per-socket run -I 500 -e cycles,instructions run -I 500 -dddd run -I 500 -x, run -I 500 --per-core -x, run -I 500 --per-socket -x, run -I 500 -e cycles,instructions -x, run -I 500 -dddd -x, runprog -r3 runprog -r3 -x, $PERF stat -r3 true $PERF stat -r3 -x, true sleep 3 & $PERF stat --per-thread -p $! sleep 1 $PERF stat --per-thread -t $! sleep 1