summaryrefslogtreecommitdiff
path: root/tools/tracing/rtla/tests/scripts/lib/get_workload_pids.sh
blob: d10a4e3b321dc347bc4288f781e51ef29343a0cf (plain)
1
2
3
4
5
6
7
8
9
10
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$"
}