Files
sunnypilot/tools/scripts/profiling/py-spy/profile.sh
T
github-actions[bot] 3e87c0fd46 sunnypilot v2026.003.000
version: sunnypilot v2026.003.000 (staging)
date: 2026-09-03T14:24:40
master commit: 132b31f4cf
2026-09-03 14:24:40 +00:00

22 lines
431 B
Bash
Executable File

#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"
# find process with name passed in (excluding this process)
for PID in $(pgrep -f $1); do
if [ "$PID" != "$$" ]; then
ps -p $PID -o args
TRACE_PID=$PID
break
fi
done
if [ -z "$TRACE_PID" ]; then
echo "could not find PID for $1"
exit 1
fi
sudo env PATH=$PATH py-spy record -d 5 -o /tmp/perf$TRACE_PID.svg -p $TRACE_PID &&
google-chrome /tmp/perf$TRACE_PID.svg