android-perfetto-capture

android-perfetto-capture is a skill for Claude Code, Codex from ttdazi/AndroidAISkills. It costs 127 tokens per session (2,103 once invoked), scanned A, original, Apache-2.0.

A guide to recording Android system traces with Perfetto, an Android performance-tracing tool, through ADB. It covers text-based recording configurations, retrieving trace files, and handing them to Perfetto’s viewer or SQL analysis tools.

In plain words
What is it for?
Use it to record performance traces, investigate freezes and jank, capture ANR-related activity, pull trace files from devices, and prepare them for later analysis.
Why use it?
It provides a repeatable way to capture scheduling, graphics, and long-running behavior when short recordings might miss an intermittent problem such as an ANR, where an app stops responding.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to record performance traces, investigate freezes and jank, capture ANR-related activity, pull trace files from devices, and prepare them for later analysis.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ttdazi/androidaiskills/android-perfetto-capture
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ttdazi/AndroidAISkills --skill android-perfetto-capture
Clone the repo
git clone --depth 1 https://github.com/ttdazi/AndroidAISkills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for android-perfetto-capture

README.md
[![agentmods](https://agentmods.dev/badge/skills/ttdazi/androidaiskills/android-perfetto-capture/github.svg)](https://agentmods.dev/skills/ttdazi/androidaiskills/android-perfetto-capture)
Your own site
<a href="https://agentmods.dev/skills/ttdazi/androidaiskills/android-perfetto-capture"><img src="https://agentmods.dev/badge/skills/ttdazi/androidaiskills/android-perfetto-capture/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for android-perfetto-capture

Your own site · 80×15
<a href="https://agentmods.dev/skills/ttdazi/androidaiskills/android-perfetto-capture"><img src="https://agentmods.dev/badge/skills/ttdazi/androidaiskills/android-perfetto-capture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 127 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,103 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00127 $0.02103
Opus 5.5 $0.00051 $0.00841
Sonnet 5.5 $0.00025 $0.00421
Haiku 4.5 $0.00013 $0.00210

Measured 3mo ago against content hash 883e29330716, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

android-perfetto-capture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/anr-perfetto-watch.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

android-perfetto-capture/SKILL.md · 84 lines

How it starts

The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Android:Perfetto 采集(adb 主线)

何时用本 skill

  • 需要 adb shell perfetto 在真机/工程机上录 系统级 Perfetto trace,并用 adb pull 取回。
  • 需要 可版本化 的采集配置(本 skill 自带 configs/*.pbtxt),避免「设置里找不到系统跟踪」类 OEM 差异。
  • ANR:出现时间不可预期,短固定 duration_ms 容易录空;用 configs/anr-surveillance.pbtxt + 后台/分离式启动,复现到 ANR 后 尽快结束 perfetto 再 adb pull(见下文「ANR 场景」)。需要 view/gfx atrace 时改用 configs/anr-surveillance-graphics.pbtxt(体积更大)。
  • 采集完成后要衔接 Perfetto UI 或 trace_processor + perfetto-sql 做分析(SQL 细节不在本 skill 展开)。

本 skill 给出 Agent 协助时的 稳定默认路径。涉及 TraceConfig 字段、平台对 perfetto 的说明、与 adb 配套的官方表述 时,不得以未经验证的网页摘要或第三方索引代替正文:须按 android-cli-docs-skills 使用终端 android docs search(如 perfetto、system trace、TraceConfig 等关键词),对结果中的 kb://... 用 android docs fetch 拉取后再引用;未 fetch 到正文不得编造。

前置检查

  1. adb devices 为 device;多设备一律 -s <serial>(细则见 android-adb-emulator)。
  2. 设备 Android 10+;存在可执行的 /system/bin/perfetto(极少数裁剪 ROM 可能没有)。
  3. 配置为 文本 proto 时,命令必须带 --txt。

默认工作流(推荐)

  1. 使用本目录下的 configs/minimal.pbtxt(先打通)或 configs/standard.pbtxt(通用卡顿/调度向)。
  2. adb push 配置到设备 /data/local/tmp/(示例见 examples.md)。
  3. 执行:
    adb shell perfetto -c /data/local/tmp/<配置名>.pbtxt --txt -o /data/local/tmp/<输出名>.perfetto-trace
    进程会阻塞至配置中的 duration_ms 结束。
  4. adb pull 将输出拉回 PC;本地文件名建议带 时间戳 + serial。

设备路径原则:优先 /data/local/tmp/ 作为配置与输出目录;避免默认假设可写 /data/misc/perfetto-traces/(权限因 ROM 而异)。

ANR 场景(不定时长看守)

问题:minimal / standard 以固定 duration_ms 为主,适合「已知短复现窗」;ANR 往往 长时间偶发,短窗录不到、长窗阻塞终端且文件暴涨。

推荐做法:

  1. 使用 configs/anr-surveillance.pbtxt:主缓冲为 RING_BUFFER、duration_ms 仅作上限(默认 2 小时量级,可按需改小),数据源相对 standard 略减(减轻长时间开销)。
  2. 先启动采集(非阻塞),再去做复现;一旦出现 ANR(或弹窗/卡死可判定),尽快结束 设备上的 perfetto 进程,使输出文件落盘完整,然后 adb pull。具体 --background / nohup ... & / pidof+kill 以设备 perfetto --help 与 android-cli-docs-skills 拉取的正文为准(示例见 examples.md 第 5 节)。团队内可统一用 scripts/anr-perfetto-watch.py(Python 3) 自动监听 logcat 或手动收尾并拉取产物(见 examples.md 第 6.9 节)。
  3. 与文本证据配合:traces.txt / bugreport 里的 ANR 栈仍用 parsing-android-anr;Perfetto trace 提供 时间线、调度与 log 侧证,两者互补。

Read the full file on GitHub · 84 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 84 lines · 127 tokens per session scan A 883e29330716

Subscribe to this mod's changes

android-perfetto-capture is a skill published in the GitHub repository ttdazi/AndroidAISkills (5 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 127 tokens to every session and 2,103 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

android-perfetto-capture compared with skills from other repositories

android-perfetto-capture next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
android-perfetto-capturettdazi/AndroidAISkillsSkill56mo agoApache-2.0A127Claude Code, Codex
ios-fixgarrytan/gstackSkill143ktodayMITA28Claude Code
node-connectopenclaw/openclawSkill396ktodayMITA39Claude Code, Codex
google-mobile-ads-validategoogle/skillsSkill25kyesterdayApache-2.0A84Claude Code, Codex
jetpack-compose-performanceandroid/skillsSkill11k9d agoApache-2.0A41Claude Code
competition-ios-runtimezhaoxuya520/reverse-skillSkill46k18d agoMITA123Codex
android-tombstone-symbolicationdotnet/skillsSkill6.4ktodayMITA176Claude Code