20 lines
701 B
Bash
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
|