#!/bin/bash
PID=$(pgrep -f 'main.py')
echo "PID: $PID"
echo "=== STATE ==="
cat /proc/$PID/status | grep -E 'State|Threads|VmRSS|VmSize'
echo "=== TOP THREADS ==="
ps -p $PID -T -o spid,state,%cpu,%mem,time,comm | head -20
echo "=== COMGR CACHE ==="
ls -lt ~/.cache/comgr/ | head -5
echo "=== GPU MEM ==="
cat /sys/class/drm/card0/device/mem_info_vram_used 2>/dev/null || echo "N/A"
cat /sys/class/drm/card0/device/mem_info_gtt_used 2>/dev/null || echo "N/A"
echo "=== STRACE SAMPLE ==="
timeout 2 strace -p $PID -e trace=write,read,ioctl -c 2>&1 || echo "strace failed (needs root?)"
