Files
church-translate/app/tools/diag.sh
T

40 lines
1.8 KiB
Bash
Raw Normal View History

#!/bin/bash
# Church Translate — one-shot diagnostic for "it is behind / in the red".
# Read-only: reads the log and asks the running app for its status. Changes nothing.
L="$HOME/Library/Application Support/Church Translate/data/logs/app.log"
C="$HOME/Library/Application Support/Church Translate/data/config.json"
echo "=== MACHINE ==="
system_profiler SPHardwareDataType 2>/dev/null | grep -E "Model Name|Chip|Total Number of Cores|Memory:" | sed 's/^ */ /'
echo " macOS $(sw_vers -productVersion)"
echo
echo "=== MEMORY PRESSURE / SWAP ==="
memory_pressure 2>/dev/null | grep -Ei "free percentage|pageouts" | sed 's/^/ /'
sysctl -n vm.swapusage 2>/dev/null | sed 's/^/ swap: /'
echo
echo "=== WHAT THE APP CHOSE AT STARTUP ==="
grep -E "GPU features \(speech\)|no GPU acceleration|no fp16|loading the speech model|loading the translation model|speech model ready|translation model ready|models could not load" "$L" 2>/dev/null | tail -8 | sed 's/^/ /'
echo
echo "=== THROUGHPUT — is it slower than people talk? ==="
echo " slow-sentence events (>4s): $(grep -c 'slow sentence' "$L" 2>/dev/null)"
grep "slow sentence" "$L" 2>/dev/null | tail -12 | sed 's/^/ /'
grep -E "stepping down to a lighter" "$L" 2>/dev/null | tail -3 | sed 's/^/ /'
echo
echo "=== THE RED CONDITION ==="
echo " caption-only events: $(grep -c 'caption only' "$L" 2>/dev/null)"
grep -E "caption only|stale — caption only" "$L" 2>/dev/null | tail -6 | sed 's/^/ /'
echo
echo "=== LIVE STATUS ==="
TOK=$(grep -o '"controlToken"[[:space:]]*:[[:space:]]*"[^"]*"' "$C" 2>/dev/null | sed 's/.*"\([^"]*\)"$/\1/')
curl -s -m 5 "http://127.0.0.1:3100/api/control/status?key=$TOK" 2>/dev/null | head -c 1500
echo
echo
echo "=== RECENT ERRORS ==="
grep "\[app\] err" "$L" 2>/dev/null | grep -v "natural voice fell back" | tail -12 | sed 's/^/ /'