This repository has been archived on 2026-08-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ROCm-Research-Archive/Scripts and Tests/findbusy.sh
T
2026-08-20 00:45:43 +02:00

20 lines
701 B
Bash

#!/bin/bash
# Find the busy thread (the one eating CPU)
echo "=== BUSY THREADS ==="
for tid in $(ls /proc/15070/task/); do
utime1=$(cat /proc/15070/task/$tid/stat 2>/dev/null | awk '{print $14}')
sleep 1
utime2=$(cat /proc/15070/task/$tid/stat 2>/dev/null | awk '{print $14}')
if [ -n "$utime1" ] && [ -n "$utime2" ]; then
diff=$((utime2 - utime1))
if [ "$diff" -gt 50 ]; then
echo "Thread $tid: delta_utime=$diff (BUSY)"
wchan=$(cat /proc/15070/task/$tid/wchan 2>/dev/null)
echo " wchan: $wchan"
fi
fi
done
echo "=== STRACE SAMPLE (2s) ==="
sudo timeout 2 strace -p 15070 -e trace=write,read,openat -c 2>&1 | head -30