android-profiler

Records and analyzes Android performance traces, heap dumps, and PerfettoSQL queries.

7.1k|466|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/android/skills --skill android-profiler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-profiler
Source: https://github.com/android/skills/tree/main/profilers/android-profiler
Command: npx skills add https://github.com/android/skills --skill android-profiler

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Diagnosing Android performance issues like jank, memory leaks, slow app startup, and CPU bottlenecks requires deep expertise in Perfetto traces, heap dumps, and SQL-based trace analysis, which is time-consuming and error-prone to do manually.

Core Features & Use Cases

  • Trace Recording: Record system traces, Java heap dumps, native heap profiles, and CPU callstack samples on Android devices using official Perfetto helper scripts or custom trace configs.
  • Trace Analysis: Triage and root-cause performance issues such as jank, ANRs, startup latency, and memory pressure by following structured investigation protocols with subsystem expert hints (CPU, graphics, I/O, IPC, memory, power).
  • Ad-hoc PerfettoSQL: Write, debug, and execute PerfettoSQL queries against trace files using trace_processor sessions, with schema validation and standard library best practices.
  • Use Case: A user notices dropped frames in their app, records a system trace with the recording workflow, then runs the trace analysis workflow to identify that a binder transaction to system_server blocked the main thread for 150ms.

Quick Start

Ask your agent to record a system trace of your app and analyze it to find the root cause of the jank you are seeing.

Frequently Asked Questions about android-profiler

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I record a system trace on an Android device?

Use the official Perfetto helper scripts such as record_android_trace with categories like sched, gfx, and wm after enabling USB debugging. The skill's recording workflow handles pushing configs, starting tracing daemons, and pulling the trace file.

How do I analyze a Perfetto trace to find the cause of jank?

Load the trace into a trace_processor session, run a system-wide triage with metrics like android_cpu and android_surfaceflinger, then investigate candidate threads by following their state transitions and dependency chains to the root cause.

How do I capture a Java heap dump to investigate a memory leak?

Run the java_heap_dump helper script with your app's package name to capture a snapshot of all Java objects. You can then query the heap graph and dominator tree in trace_processor to find retained objects and leak paths.

Does trace_processor work on Windows?

Yes, but instead of adding it to PATH you invoke it as python followed by the trace_processor script path. The first invocation downloads the correct prebuilt native binary for your platform and caches it.

Why does my PerfettoSQL query fail or return wrong results?

Common causes include guessing column names instead of checking schema with LIMIT 0, joining on tid/pid instead of utid/upid, using LIKE instead of GLOB, or missing INCLUDE PERFETTO MODULE statements for stdlib tables.

When should I use a custom trace config instead of helper scripts?

Use a custom TraceConfig when you need to combine multiple data sources in one trace, such as ftrace with heap dumps, or need controls like ring buffers and periodic file writes that the specialized helper scripts do not expose.