Skip to content

Commit 887f54d

Browse files
committed
tools: add "procnames" helper
1 parent 30e8e2d commit 887f54d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/procnames

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
# Print the thread names of a thread group
3+
pid="$1"
4+
if [ "$COLUMNS" = "0" ]; then
5+
grep '' "/proc/$pid"/task/*/stat
6+
else
7+
if [ -z "$COLUMNS" ]; then
8+
set -- $(stty size)
9+
COLUMNS="$2"
10+
fi
11+
grep -h '' "/proc/$pid"/task/*/stat | cut -b "1-$COLUMNS"
12+
fi

0 commit comments

Comments
 (0)