From: Wander Lairson Costa <wander@redhat.com>
To: williams@redhat.com, jkacur@redhat.com, linux-rt-users@vger.kernel.org
Cc: juri.lelli@redhat.com, luffyluo@tencent.com,
davidlt@rivosinc.com, Wander Lairson Costa <wander@redhat.com>
Subject: [PATCH 10/11] tests: add startup timing to stalld launch helpers
Date: Fri, 10 Jul 2026 10:38:09 -0300 [thread overview]
Message-ID: <20260710133810.72398-11-wander@redhat.com> (raw)
In-Reply-To: <20260710133810.72398-1-wander@redhat.com>
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 <wander@redhat.com>
---
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
next prev parent reply other threads:[~2026-07-10 13:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 13:37 [PATCH 00/11] tests: harden functional test suite against flakiness Wander Lairson Costa
2026-07-10 13:38 ` [PATCH 01/11] stalld: add readiness log marker for tests Wander Lairson Costa
2026-07-10 13:38 ` [PATCH 02/11] tests: use fail() for error paths in helpers Wander Lairson Costa
2026-07-10 13:38 ` [PATCH 03/11] tests: add --verbose flag for bash trace output Wander Lairson Costa
2026-07-10 13:38 ` [PATCH 04/11] tests: drop journal logging from test framework Wander Lairson Costa
2026-07-10 13:38 ` [PATCH 05/11] tests: fix intermittent starvation_gen readiness failure Wander Lairson Costa
2026-07-10 13:38 ` [PATCH 06/11] tests: add --fail-fast flag to stop on first failure Wander Lairson Costa
2026-07-10 13:38 ` [PATCH 07/11] tests: dump log contents on assert_log_contains failure Wander Lairson Costa
2026-07-10 13:38 ` [PATCH 08/11] tests: dump log on start_stalld_with_log failure Wander Lairson Costa
2026-07-10 13:38 ` [PATCH 09/11] tests: start stalld before starvation_gen in all tests Wander Lairson Costa
2026-07-10 13:38 ` Wander Lairson Costa [this message]
2026-07-10 13:38 ` [PATCH 11/11] tests: increase stalld initialization timeout to 240s Wander Lairson Costa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260710133810.72398-11-wander@redhat.com \
--to=wander@redhat.com \
--cc=davidlt@rivosinc.com \
--cc=jkacur@redhat.com \
--cc=juri.lelli@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=luffyluo@tencent.com \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.