Release 260111

This commit is contained in:
Comma Device
2026-01-11 18:23:29 +08:00
commit 3721ecbf8a
2601 changed files with 855070 additions and 0 deletions

22
tools/profiling/clpeak/build.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR
if [ ! -d "$DIR/clpeak" ]; then
git clone https://github.com/krrishnarraj/clpeak.git
cd clpeak
git fetch
git checkout ec2d3e70e1abc7738b81f9277c7af79d89b2133b
git reset --hard origin/master
git submodule update --init --recursive --remote
git apply ../run_continuously.patch
fi
cd clpeak
mkdir build || true
cd build
cmake ..
cmake --build .

View File

@@ -0,0 +1,39 @@
diff --git a/src/logger.cpp b/src/logger.cpp
index a63c6dd..a1d9860 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -24,34 +24,22 @@ logger::~logger()
void logger::print(string str)
{
- cout << str;
- cout.flush();
}
void logger::print(double val)
{
- cout << setprecision(2) << fixed;
- cout << val;
- cout.flush();
}
void logger::print(float val)
{
- cout << setprecision(2) << fixed;
- cout << val;
- cout.flush();
}
void logger::print(int val)
{
- cout << val;
- cout.flush();
}
void logger::print(unsigned int val)
{
- cout << val;
- cout.flush();
}
void logger::xmlOpenTag(string tag)

View File

@@ -0,0 +1,13 @@
diff --git a/src/clpeak.cpp b/src/clpeak.cpp
index 8cb192b..b6fe6f5 100644
--- a/src/clpeak.cpp
+++ b/src/clpeak.cpp
@@ -47,7 +47,7 @@ int clPeak::runAll()
log->xmlOpenTag("clpeak");
log->xmlAppendAttribs("os", OS_NAME);
- for (size_t p = 0; p < platforms.size(); p++)
+ for (size_t p = 0; p < platforms.size(); (p+1 % platforms.size()))
{
if (forcePlatform && (p != specifiedPlatform))
continue;

24
tools/profiling/ftrace.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e
cd /sys/kernel/tracing
echo 1 > tracing_on
echo boot > trace_clock
echo 1000 > buffer_size_kb
# /sys/kernel/tracing/available_events
echo 0 > events/enable
#echo 1 > events/irq/enable
#echo 1 > events/sched/enable
#echo 1 > events/kgsl/enable
#echo 1 > events/camera/enable
echo 1 > events/workqueue/enable
echo > trace
sleep 2
echo 0 > tracing_on
cp trace /tmp/trace
chown comma: /tmp/trace
echo /tmp/trace

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd $DIR
if [ ! -d palanteer ]; then
git clone https://github.com/dfeneyrou/palanteer
pip install wheel
sudo apt install libunwind-dev libdw-dev
fi
cd palanteer
git pull
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
pip install --force-reinstall python/dist/palanteer*.whl
cp bin/palanteer $DIR/viewer

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
if [ ! -d perfetto ]; then
git clone https://android.googlesource.com/platform/external/perfetto/
fi
cd perfetto
tools/install-build-deps --linux-arm
tools/gn gen --args='is_debug=false target_os="linux" target_cpu="arm64"' out/linux
tools/ninja -C out/linux tracebox traced traced_probes perfetto

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
DEST=tici:/data/openpilot/selfdrive/debug/profiling/perfetto
scp -r perfetto/out/linux/tracebox $DEST
scp -r perfetto/test/configs $DEST

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd $DIR
OUT=trace_
sudo ./tracebox -o $OUT --txt -c configs/scheduling.cfg
sudo chown $USER:$USER $OUT

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
curl -LO https://get.perfetto.dev/trace_processor
chmod +x ./trace_processor
./trace_processor --httpd

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
DEST=tici:/data/openpilot/selfdrive/debug/profiling/perfetto
scp tici:/data/openpilot/selfdrive/debug/profiling/perfetto/trace_* .

View File

@@ -0,0 +1,21 @@
#!/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

View File

@@ -0,0 +1,13 @@
snapdragon profiler
--------
* download from https://developer.qualcomm.com/software/snapdragon-profiler/tools-archive (need a qc developer account)
* choose v2021.5 (verified working with 24.04 dev environment)
* unzip to selfdrive/debug/profiling/snapdragon/SnapdragonProfiler
* run ```./setup-profiler.sh```
* run ```./setup-agnos.sh```
* run ```selfdrive/debug/adb.sh``` on device
* run the ```adb connect xxx``` command that was given to you on local pc
* cd to SnapdragonProfiler and run ```./run_sdp.sh```
* connect to device -> choose device you just setup

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# TODO: there's probably a better way to do this
cd SnapdragonProfiler/service
mv android real_android
ln -s agl/ android

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# install depends
sudo apt update
sudo apt-get install libc++1 libc++abi1 default-jre android-tools-adb gtk-sharp2
# setup mono
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt install apt-transport-https ca-certificates
echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt-get install -y mono-complete
echo "Setup successful, you should now be able to run the profiler with cd SnapdragonProfiler and ./run_sdp.sh"

4
tools/profiling/watch-irqs.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -e
RUBYOPT="-W0" irqtop -d1 -R