[PATCH 10/11] tests: add startup timing to stalld launch helpers
Wander Lairson Costa <[email protected]> Fri, 10 Jul 2026 10:38:09 -0300
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
Instrument start_stalld and start_stalld_with_log to measure and log the elapsed time from process launch to readiness. Both functions capture nanosecond timestamps via date +%s%N before and after the startup sequence, compute the elapsed seconds with awk, and report the result through log(). The echo in start_stalld is converted to log() for consistency with the rest of the test framework. Signed-off-by: Wander Lairson Costa <[email protected]> --- tests/helpers/test_helpers.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/helpers/test_helpers.sh b/tests/helpers/test_helpers.sh index 85b1805..9222d07 100755 --- a/tests/helpers/test_helpers.sh +++ b/tests/helpers/test_helpers.sh @@ -459,6 +459,8 @@ start_stalld() { esac fi + local start_ns=$(date +%s%N) + ${stalld_bin} ${args} & local shell_pid=$! @@ -537,7 +539,9 @@ start_stalld() { fi CLEANUP_PIDS+=("${STALLD_PID}") - echo "stalld started with PID ${STALLD_PID}" + local end_ns=$(date +%s%N) + local elapsed=$(awk "BEGIN {printf \"%.3f\", (${end_ns} - ${start_ns}) / 1000000000}") + log "stalld started with PID ${STALLD_PID} (startup: ${elapsed}s)" return 0 } @@ -1152,6 +1156,8 @@ start_stalld_with_log() { # Start stalld with line-buffered output so tail -f can detect # readiness immediately instead of waiting for the buffer to fill. + local start_ns=$(date +%s%N) + stdbuf -oL ${TEST_ROOT}/../stalld ${stalld_args} > "${log_file}" 2>&1 & STALLD_PID=$! CLEANUP_PIDS+=("${STALLD_PID}") @@ -1162,6 +1168,10 @@ start_stalld_with_log() { stop_stalld fail "stalld did not initialize within 15s" fi + + local end_ns=$(date +%s%N) + local elapsed=$(awk "BEGIN {printf \"%.3f\", (${end_ns} - ${start_ns}) / 1000000000}") + log "stalld ready (PID ${STALLD_PID}, startup: ${elapsed}s)" } # Wait for scheduling policy to change to expected value -- 2.55.0