Daniel Wagner | 72624fd | 2019-07-23 09:38:10 +0200 | [diff] [blame] | 1 | #!/bin/sh -e |
| 2 | # cyclicdeadline is a test that is similar to cyclictest but instead |
| 3 | # of using SCHED_FIFO and nanosleep() to measure jitter, it uses |
| 4 | # SCHED_DEADLINE and has the deadline be the wakeup interval." |
| 5 | |
| 6 | # shellcheck disable=SC1091 |
| 7 | . ../../lib/sh-test-lib |
| 8 | |
| 9 | OUTPUT="$(pwd)/output" |
| 10 | LOGFILE="${OUTPUT}/cyclicdeadline.txt" |
| 11 | RESULT_FILE="${OUTPUT}/result.txt" |
| 12 | |
| 13 | INTERVAL="1000" |
| 14 | STEP="500" |
| 15 | THREADS="1" |
| 16 | DURATION="1m" |
| 17 | MAX_LATENCY="50" |
| 18 | |
| 19 | usage() { |
| 20 | echo "Usage: $0 [-i interval] [-s step] [-t threads] [-D duration ] [-m latency]" 1>&2 |
| 21 | exit 1 |
| 22 | } |
| 23 | |
| 24 | while getopts ":i:s:t:D:m:" opt; do |
| 25 | case "${opt}" in |
| 26 | i) INTERVAL="${OPTARG}" ;; |
| 27 | s) STEP="${STEP}" ;; |
| 28 | t) THREADS="${OPTARG}" ;; |
| 29 | D) DURATION="${OPTARG}" ;; |
| 30 | m) MAX_LATENCY="${OPTARG}" ;; |
| 31 | *) usage ;; |
| 32 | esac |
| 33 | done |
| 34 | |
| 35 | ! check_root && error_msg "Please run this script as root." |
| 36 | create_out_dir "${OUTPUT}" |
| 37 | |
| 38 | # Run cyclicdeadline. |
| 39 | if ! binary=$(command -v cyclicdeadline); then |
| 40 | detect_abi |
| 41 | # shellcheck disable=SC2154 |
| 42 | binary="./bin/${abi}/cyclicdeadline" |
| 43 | fi |
| 44 | "${binary}" -i "${INTERVAL}" -s "${STEP}" -t "${THREADS}" \ |
| 45 | -D "${DURATION}" | tee "${LOGFILE}" |
| 46 | |
| 47 | # Parse test log. |
| 48 | ../../lib/parse_rt_tests_results.py cyclicdeadline "${LOGFILE}" "${MAX_LATENCY}" \ |
| 49 | | tee -a "${RESULT_FILE}" |