Skip to content

Commit 7c287f4

Browse files
committed
[DNM] test latency threshold
Signed-off-by: Pawel Langowski <pawelx.langowski@intel.com>
1 parent 5124961 commit 7c287f4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test-case/latency-metrics.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ OPT_HAS_ARG['t']=0 OPT_VAL['t']=0
8888
OPT_NAME['T']='trial-until' OPT_DESC['T']="Trial mode: repeat until this value."
8989
OPT_HAS_ARG['T']=1 OPT_VAL['T']=2
9090

91+
OPT_NAME['l']='latency_threshold' OPT_DESC['l']='latency threshold in ms'
92+
OPT_HAS_ARG['l']=1 OPT_VAL['l']=30
93+
9194
func_opt_parse_option "$@"
9295

9396
alsa_device=${OPT_VAL['d']}
@@ -106,6 +109,7 @@ jackd_period=${jackd_frames}
106109
jackd_nperiods=${OPT_VAL['n']}
107110
trial_mode=${OPT_VAL['t']}
108111
trial_until=${OPT_VAL['T']}
112+
latency_threshold=${OPT_VAL['l']}
109113

110114
METRICS_JSON="${LOG_ROOT}/metrics_iodelay.json"
111115
EVENTS_JSON="${LOG_ROOT}/events_jackd.json"
@@ -254,6 +258,12 @@ report_metric()
254258

255259
printf '%s}' "${metrics_}" >> "${RESULT_JSON}" && rm "${METRICS_JSON}"
256260

261+
avg_latency=$(echo "{${metrics_}}" | jq '.avg_ms')
262+
dlogi "Avg latency: ${avg_latency}ms"
263+
if [ "$avg_latency" -gt "$latency_threshold" ]; then
264+
skip_test "Avg latency ${avg_latency}ms is higher than threshold ${latency_threshold}ms"
265+
fi
266+
257267
xruns=$(echo "{${metrics_}}" | jq 'select(.xruns > 0).xruns')
258268
if [ -n "${xruns}" ] && [ "${xruns}" -gt "${max_xruns}" ]; then
259269
printf ']}' >> "${RESULT_JSON}"

0 commit comments

Comments
 (0)