Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
155 lines
4.1 KiB
Bash
Executable File
155 lines
4.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
ANDROID_DIR="$(cd -- "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
PACKAGE="ai.openclaw.app"
|
|
ACTIVITY=".MainActivity"
|
|
DURATION_SECONDS="10"
|
|
OUTPUT_PERF_DATA=""
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage:
|
|
./scripts/perf-startup-hotspots.sh [--package <pkg>] [--activity <activity>] [--duration <sec>] [--out <perf.data>]
|
|
|
|
Captures startup CPU profile via simpleperf (app_profiler.py), then prints concise hotspot summaries.
|
|
Default package/activity target OpenClaw Android startup.
|
|
EOF
|
|
}
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--package)
|
|
PACKAGE="${2:-}"
|
|
shift 2
|
|
;;
|
|
--activity)
|
|
ACTIVITY="${2:-}"
|
|
shift 2
|
|
;;
|
|
--duration)
|
|
DURATION_SECONDS="${2:-}"
|
|
shift 2
|
|
;;
|
|
--out)
|
|
OUTPUT_PERF_DATA="${2:-}"
|
|
shift 2
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Unknown arg: $1" >&2
|
|
usage >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if ! command -v uv >/dev/null 2>&1; then
|
|
echo "uv required but missing." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v adb >/dev/null 2>&1; then
|
|
echo "adb required but missing." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z "$OUTPUT_PERF_DATA" ]]; then
|
|
OUTPUT_PERF_DATA="/tmp/openclaw-startup-$(date +%Y%m%d-%H%M%S).perf.data"
|
|
fi
|
|
|
|
device_count="$(adb devices | awk 'NR>1 && $2=="device" {c+=1} END {print c+0}')"
|
|
if [[ "$device_count" -lt 1 ]]; then
|
|
echo "No connected Android device (adb state=device)." >&2
|
|
exit 1
|
|
fi
|
|
|
|
simpleperf_dir=""
|
|
if [[ -n "${ANDROID_NDK_HOME:-}" && -f "${ANDROID_NDK_HOME}/simpleperf/app_profiler.py" ]]; then
|
|
simpleperf_dir="${ANDROID_NDK_HOME}/simpleperf"
|
|
elif [[ -n "${ANDROID_NDK_ROOT:-}" && -f "${ANDROID_NDK_ROOT}/simpleperf/app_profiler.py" ]]; then
|
|
simpleperf_dir="${ANDROID_NDK_ROOT}/simpleperf"
|
|
else
|
|
latest_simpleperf="$(ls -d "${HOME}/Library/Android/sdk/ndk/"*/simpleperf 2>/dev/null | sort -V | tail -n1 || true)"
|
|
if [[ -n "$latest_simpleperf" && -f "$latest_simpleperf/app_profiler.py" ]]; then
|
|
simpleperf_dir="$latest_simpleperf"
|
|
fi
|
|
fi
|
|
|
|
if [[ -z "$simpleperf_dir" ]]; then
|
|
echo "simpleperf not found. Set ANDROID_NDK_HOME or install NDK under ~/Library/Android/sdk/ndk/." >&2
|
|
exit 1
|
|
fi
|
|
|
|
app_profiler="$simpleperf_dir/app_profiler.py"
|
|
report_py="$simpleperf_dir/report.py"
|
|
ndk_path="$(cd -- "$simpleperf_dir/.." && pwd)"
|
|
|
|
tmp_dir="$(mktemp -d -t openclaw-android-hotspots.XXXXXX)"
|
|
trap 'rm -rf "$tmp_dir"' EXIT
|
|
|
|
capture_log="$tmp_dir/capture.log"
|
|
dso_csv="$tmp_dir/dso.csv"
|
|
symbols_csv="$tmp_dir/symbols.csv"
|
|
children_txt="$tmp_dir/children.txt"
|
|
|
|
cd "$ANDROID_DIR"
|
|
./gradlew :app:installDebug --console=plain >"$tmp_dir/install.log" 2>&1
|
|
|
|
if ! uv run --no-project python3 "$app_profiler" \
|
|
-p "$PACKAGE" \
|
|
-a "$ACTIVITY" \
|
|
-o "$OUTPUT_PERF_DATA" \
|
|
--ndk_path "$ndk_path" \
|
|
-r "-e task-clock:u -f 1000 -g --duration $DURATION_SECONDS" \
|
|
>"$capture_log" 2>&1; then
|
|
echo "simpleperf capture failed. tail(capture_log):" >&2
|
|
tail -n 120 "$capture_log" >&2
|
|
exit 1
|
|
fi
|
|
|
|
uv run --no-project python3 "$report_py" \
|
|
-i "$OUTPUT_PERF_DATA" \
|
|
--sort dso \
|
|
--csv \
|
|
--csv-separator "|" \
|
|
--include-process-name "$PACKAGE" \
|
|
>"$dso_csv" 2>"$tmp_dir/report-dso.err"
|
|
|
|
uv run --no-project python3 "$report_py" \
|
|
-i "$OUTPUT_PERF_DATA" \
|
|
--sort dso,symbol \
|
|
--csv \
|
|
--csv-separator "|" \
|
|
--include-process-name "$PACKAGE" \
|
|
>"$symbols_csv" 2>"$tmp_dir/report-symbols.err"
|
|
|
|
uv run --no-project python3 "$report_py" \
|
|
-i "$OUTPUT_PERF_DATA" \
|
|
--children \
|
|
--sort dso,symbol \
|
|
-n \
|
|
--percent-limit 0.2 \
|
|
--include-process-name "$PACKAGE" \
|
|
>"$children_txt" 2>"$tmp_dir/report-children.err"
|
|
|
|
clean_csv() {
|
|
awk 'BEGIN{print_on=0} /^Overhead\|/{print_on=1} print_on==1{print}' "$1"
|
|
}
|
|
|
|
echo "perf_data=$OUTPUT_PERF_DATA"
|
|
echo
|
|
echo "top_dso_self:"
|
|
clean_csv "$dso_csv" | tail -n +2 | awk -F'|' 'NR<=10 {printf " %s %s\n", $1, $2}'
|
|
echo
|
|
echo "top_symbols_self:"
|
|
clean_csv "$symbols_csv" | tail -n +2 | awk -F'|' 'NR<=20 {printf " %s %s :: %s\n", $1, $2, $3}'
|
|
echo
|
|
echo "app_path_clues_children:"
|
|
rg 'androidx\.compose|MainActivity|NodeRuntime|NodeForegroundService|SecurePrefs|WebView|libwebviewchromium' "$children_txt" | awk 'NR<=20 {print}' || true
|