android-performance
БесплатноЗапускает вложенные скриптыНе проверенGather and interpret Android performance evidence on an adb target using Simpleperf CPU profiles, Perfetto or Compose traces, gfxinfo frame data, dumpsys…
от openai★ 8 494 звезды на GitHubОб этом скилле
Android Performance
Use this skill to capture Android performance evidence for adb-installable apps. CPU sampling usually requires a debuggable or profileable build; frame stats, Perfetto, and logcat can still help when an app cannot be sampled. Compose with ../android-emulator-qa/SKILL.md for device selection, build/install/launch, UI driving, screenshots, UI trees, and logcat capture.
Core Workflow
- Pick one focused user-visible flow.
- Choose the trace type that matches the question.
- Record the flow with clear start and stop boundaries.
- Pull or copy the trace produced by that run, then generate reports from that file.
- Interpret reports with caveats about device, build type, sample count, and profiler limits.
Avoid broad "use the app for a while" captures. They make traces hard to attribute and usually hide the functions that matter.
Use a local adb target for meaningful timing. Store outputs in a run-specific artifact folder outside the skill directory:
if [ -z "${ARTIFACT_DIR:-}" ]; then
ARTIFACT_DIR="$(mktemp -d "${TMPDIR:-/tmp}/codex-android-perf.XXXXXX")"
fi
mkdir -p "$ARTIFACT_DIR"
Do not put ARTIFACT_DIR under SKILL_DIR; the skill folder is for bundled instructions and scripts, not run artifacts.
Choosing A Trace
- Use Simpleperf when the question is "what functions are taking CPU time?" or when you need a sampled profile of Kotlin, Java, native, or framework execution.
- Use Perfetto when the question is frame timing, startup timeline, scheduler gaps, binder work, lock contention, main-thread stalls, Compose recomposition, or why a flow felt janky.
- Use gfxinfo framestats for a quick manual frame/jank snapshot. Pair it with Perfetto when you need root cause.
- Use meminfo / heap dumps when the question is retained Java/Kotlin objects, PSS, native heap, or object counts after a focused flow.
Simpleperf CPU Profiles
Simpleperf --app works best when the installed package is debuggable or profileable from shell. Preflight before recording:
SERIAL="<adb-serial>"
PACKAGE="<app package>"
adb -s "$SERIAL" shell dumpsys package "$PACKAGE" | grep -Ei 'DEBUGGABLE|profileable|isProfileable' || true
If the package is not debuggable/profileable and simpleperf record --app fails, install a debug/profileable build when possible. If that is not possible, use Perfetto or gfxinfo instead of treating missing CPU samples as evidence.
Start recording in one terminal or as a long-running Codex command session:
SERIAL="<adb-serial>"
PACKAGE="<app package>"
MAX_DURATION_SECONDS=60
adb -s "$SERIAL" shell rm -f /data/local/tmp/perf.data
adb -s "$SERIAL" logcat -c
adb -s "$SERIAL" shell simpleperf record \
--app "$PACKAGE" \
-o /data/local/tmp/perf.data \
-e cpu-clock -f 4000 -g \
--duration "$MAX_DURATION_SECONDS"
While that command is running, perform exactly one focused flow with adb input, UI automation, or android-emulator-qa.
Stop Simpleperf from another command and wait for the recording command to exit:
adb -s "$SERIAL" shell 'pid="$(pidof simpleperf 2>/dev/null || true)"; [ -n "$pid" ] && kill -INT $pid'
If that returns Operation not permitted, send Ctrl-C to the original adb shell simpleperf record command session and wait for it to exit.
Pull and report the capture:
adb -s "$SERIAL" pull /data/local/tmp/perf.data "$ARTIFACT_DIR/perf.data"
adb -s "$SERIAL" logcat -d > "$ARTIFACT_DIR/logcat.txt"
SKILL_DIR="<absolute path to this loaded skill folder>"
FIRST_PARTY_REGEX="$(printf '%s' "$PACKAGE" | sed 's/\./\\./g')"
"$SKILL_DIR/scripts/simpleperf_hotspots.sh" \
"$ARTIFACT_DIR/perf.data" \
"$ARTIFACT_DIR" \
--serial "$SERIAL" \
--first-party-regex "$FIRST_PARTY_REGEX"
Do not derive SKILL_DIR from the target app repo's pwd; installed plugins usually live outside the app being profiled. Keep FIRST_PARTY_REGEX scoped to the app's package or app-owned module prefixes; avoid broad framework patterns such as kotlin, Compose, or androidx.compose when reporting app-owned rows.
The helper writes:
$ARTIFACT_DIR/simpleperf-self.txt$ARTIFACT_DIR/simpleperf-children.txt$ARTIFACT_DIR/simpleperf.csvwhen supported by the installed Simpleperf
If host Simpleperf is not installed, the helper searches Android Studio and Android SDK/NDK locations. If unavailable, it falls back to device-side adb shell simpleperf report when the device still has /data/local/tmp/perf.data.
Reading Simpleperf
Simpleperf reports sampled CPU execution. It does not directly measure suspended coroutines, network latency, lock wait time, or other wall-clock waits. If a flow feels slow but Simpleperf shows little app CPU, capture Perfetto to inspect scheduler gaps, binder work, locks, frame timing, and app trace sections.
Read reports this way:
- Self/Overhead: samples where the function itself was executing. Use this for hot leaf work such as parsing, formattin
Установить android-performance в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл android-performance?
Gather and interpret Android performance evidence on an adb target using Simpleperf CPU profiles, Perfetto or Compose traces, gfxinfo frame data, dumpsys meminfo snapshots, Java heap dumps, and native allocation traces. Use when asked to profile an Android app flow, find CPU-heavy functions, diagnose jank, capture startup or frame timing evidence, compare before/after performance, explain what code is taking time, or gather memory/leak profiling artifacts.
Как установить скилл android-performance?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл android-performance запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic