mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
rtla/tests: Add get_workload_pids() helper
RTLA runtime tests that check workload processes (currently the test case "verify -P/--priority" of timerlat.t and "verify the --priority/-P param" of osnoise.t) use "pgrep timerlatu/" or "pgrep osnoise/" respectively to identify the workload. Make them more robust by adding a get_workload_pids() helper that finds the main rtla process and returns the PIDs of all siblings other than the test script itself, plus all child processes of kthreadd that have the osnoise/timerlat kthread pattern comm. This filters out any spurious processes not related to the running test that happen to have "timerlatu/" or "osnoise/" in their command, for example, a user grepping the same names at the time of the running of the test. Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260423130558.882022-3-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
This commit is contained in:
parent
c15c55c01e
commit
d18fd5a34f
|
|
@ -10,7 +10,7 @@ check "verify help page" \
|
|||
check_top_hist "verify help page" \
|
||||
"osnoise TOOL --help" 0 "rtla osnoise"
|
||||
check_top_q_hist "verify the --priority/-P param" \
|
||||
"osnoise TOOL -P F:1 -c 0 -r 900000 -d 10s -S 1 --on-threshold shell,command=\"tests/scripts/check-priority.sh osnoise/ SCHED_FIFO 1\"" \
|
||||
"osnoise TOOL -P F:1 -c 0 -r 900000 -d 10s -S 1 --on-threshold shell,command=\"tests/scripts/check-priority.sh SCHED_FIFO 1\"" \
|
||||
2 "Priorities are set correctly"
|
||||
check_top_q_hist "verify the --stop/-s param" \
|
||||
"osnoise TOOL -s 30 -T 1" 2 "osnoise hit stop tracing"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
pids="$(pgrep ^$1)" || exit 1
|
||||
for pid in $pids
|
||||
. "$(dirname $0)/lib/get_workload_pids.sh"
|
||||
for pid in $(get_workload_pids)
|
||||
do
|
||||
chrt -p $pid | cut -d ':' -f 2 | head -n1 | grep "^ $2\$" >/dev/null
|
||||
chrt -p $pid | cut -d ':' -f 2 | tail -n1 | grep "^ $3\$" >/dev/null
|
||||
chrt -p $pid | cut -d ':' -f 2 | head -n1 | grep "^ $1\$" >/dev/null
|
||||
chrt -p $pid | cut -d ':' -f 2 | tail -n1 | grep "^ $2\$" >/dev/null
|
||||
done && echo "Priorities are set correctly"
|
||||
|
|
|
|||
11
tools/tracing/rtla/tests/scripts/lib/get_workload_pids.sh
Normal file
11
tools/tracing/rtla/tests/scripts/lib/get_workload_pids.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
get_workload_pids() {
|
||||
local shell_pid=$$
|
||||
local rtla_pid=$(ps -o ppid= $shell_pid)
|
||||
|
||||
# kernel threads
|
||||
pgrep -P $(pgrep ^kthreadd$) -f '^(osnoise|timerlat)/[0-9]+$'
|
||||
# user threads
|
||||
pgrep -P $rtla_pid | grep -v "^$shell_pid$"
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ check_top_hist "verify help page" \
|
|||
check_top_hist "verify -s/--stack" \
|
||||
"timerlat TOOL -s 3 -T 10 -t" 2 "Blocking thread stack trace"
|
||||
check_top_hist "verify -P/--priority" \
|
||||
"timerlat TOOL -P F:1 -c 0 -d 10s -T 1 --on-threshold shell,command=\"tests/scripts/check-priority.sh timerlatu/ SCHED_FIFO 1\"" \
|
||||
"timerlat TOOL -P F:1 -c 0 -d 10s -T 1 --on-threshold shell,command=\"tests/scripts/check-priority.sh SCHED_FIFO 1\"" \
|
||||
2 "Priorities are set correctly"
|
||||
check_top_hist "test in nanoseconds" \
|
||||
"timerlat TOOL -i 2 -c 0 -n -d 10s" 2 "ns"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user