Files
dragonpilot/tools/profiling/py-spy/profile.sh
Vehicle Researcher dd778596b7 openpilot v0.9.8 release
date: 2025-03-15T21:10:51
master commit: fb7b9c0f9420d228f03362970ebcfb7237095cf3
2025-03-18 10:05:17 -07: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