xref: /linux/tools/tracing/rtla/tests/scripts/lib/get_workload_pids.sh (revision 2ed2e359dea752e7758d29a423033031a0b96584)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3get_workload_pids() {
4    local shell_pid=$$
5    local rtla_pid=$(ps -o ppid= $shell_pid)
6
7    # kernel threads
8    pgrep -P $(pgrep ^kthreadd$) -f '^\[?(osnoise|timerlat)/[0-9]+\]?$'
9    # user threads
10    pgrep -P $rtla_pid | grep -v "^$shell_pid$"
11}
12