perfetto-trace-analysis

Analyzes Perfetto traces to diagnose latency, memory, and jank issues in Android apps.

3|Updated Aug 4, 2024
One-click install
npx skills add https://github.com/kabindra-shrestha/Clean-Architecture-Kotlin-Compose-Multiplatform --skill perfetto-trace-analysis-kabindra-shrestha
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: perfetto-trace-analysis
Source: https://github.com/kabindra-shrestha/Clean-Architecture-Kotlin-Compose-Multiplatform/tree/main/.agents/skills/profilers/perfetto-trace-analysis
Command: npx skills add https://github.com/kabindra-shrestha/Clean-Architecture-Kotlin-Compose-Multiplatform --skill perfetto-trace-analysis-kabindra-shrestha

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Android performance issues like jank, slow startup, and battery drain are hard to root-cause from raw Perfetto traces. This Skill guides an AI through a rigorous, evidence-based investigation of trace files to isolate definitive bottlenecks instead of guessing. ## Core Features & Use Cases - Structured Investigation Protocol: Follows a hypothesis-driven loop (formulate, query, drill down, verify) with a mandatory scratchpad that logs a strict chain of evidence. - Expert Domain Hints: Ships reference files for CPU, Graphics, I/O, IPC, Memory, and Power, each containing expert-vetted trace analysis techniques. - Perfetto SQL Execution Protocol: Enforces schema research against the standard library docs, GLOB-based matching, idempotent queries, and validated execution via the trace_processor wrapper. - Use Case: Given a Perfetto trace of a slow app launch, the Skill identifies the active package, queries startup metrics, checks thread states for uninterruptible sleep, follows blockers across processes, and reports the verified root cause. ## Quick Start Analyze the attached Perfetto trace file and find the root cause of the jank during app startup.

Frequently Asked Questions about perfetto-trace-analysis

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

FAQPage Schema
How do I analyze a Perfetto trace to find Android app jank?

Provide the trace file and describe the symptom. The Skill initializes a scratchpad, reviews domain hints, runs high-level trace metrics, then drills into slices and thread states with Perfetto SQL until it isolates the root cause of the jank.

How do I run Perfetto SQL queries on a trace file?

Queries are executed with the trace_processor wrapper using the --query-string flag, for example ./trace_processor --query-string "QUERY" trace_file. The Skill validates each query against the standard library schema documentation before running it.

What performance problems can Perfetto trace analysis diagnose?

It covers CPU contention and scheduling latency, graphics jank and GPU memory, I/O stalls and uninterruptible sleep, binder IPC bottlenecks, memory pressure and LMK kills, and power drain from wake locks or network traffic.

Why does a long-running slice not always mean high CPU usage?

Wall time differs from CPU time because a thread may be Runnable, Sleeping, or in Uninterruptible Sleep during a slice. The Skill queries the thread_state table for the slice's exact time window to verify what the thread was actually doing.

What are the limitations of Perfetto trace analysis?

Analysis depends on what data sources were enabled during trace collection; missing ftrace events or counters limit visibility. Queries are ephemeral with no persisted state between executions, and incomplete slices at trace boundaries have dur = -1 requiring special handling.