| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | set -e
|
| 6 |
|
| 7 | shelldir=$(dirname "$0")
|
| 8 | |
| 9 | . "${shelldir}"/lib/setup_python.sh
|
| 10 |
|
| 11 | |
| 12 | |
| 13 | event=$(perf list --json | $PYTHON -c '
|
| 14 | import json, sys
|
| 15 | for e in json.load(sys.stdin):
|
| 16 | if "EventName" not in e or "/modifier" in e["EventName"]:
|
| 17 | continue
|
| 18 | if "Encoding" in e and "period=" in e["Encoding"]:
|
| 19 | print(e["EventName"])
|
| 20 | break
|
| 21 | ')
|
| 22 | if [[ "$event" = "" ]]
|
| 23 | then
|
| 24 | echo "Skip: No sysfs/json events with inbuilt period."
|
| 25 | exit 2
|
| 26 | fi
|
| 27 |
|
| 28 | echo "Testing that for $event the period is overridden with 1000"
|
| 29 | perf list --detail "$event"
|
| 30 | if ! perf record -c 1000 -vv -e "$event" -o /dev/null true 2>&1 | \
|
| 31 | grep -q -F '{ sample_period, sample_freq } 1000'
|
| 32 | then
|
| 33 | echo "Fail: Unexpected verbose output and sample period"
|
| 34 | exit 1
|
| 35 | fi
|
| 36 | echo "Success"
|
| 37 | exit 0
|