Agent Skill · Android

perfetto-trace-analysis

Analyzes Perfetto traces to find the root cause of latency, memory, or jank issues in Android apps. Use when the user provides a Perfetto trace file and asks any question, ongoing investigation, or open-ended request to analyze its contents.

Provider: Android Path in repo: profilers/perfetto-trace-analysis/SKILL.md

Skill body

Resources

Setup Phase (Mandatory)

  1. Initialize Scratchpad (Chain of Evidence):
    • Maintain your working memory in a local scratchpad file located in the exact same directory as the target trace file.
    • Name the file using the trace’s filename appended with _analysis.md (e.g., [trace_filename]_analysis.md). Before creating it, check if a file with that name already exists by listing the directory’s contents—to avoid biasing your investigation, DO NOT read the file’s contents to check for its existence. If it does, append an incrementing version number (e.g., _v2.md, _v3.md) until you find an available filename. You MUST hardcode this exact filename in all subsequent tool calls.
    • Use this scratchpad STRICTLY to log verified facts: timestamps, slice names, thread IDs (utid/tid), and thread states.
    • DO NOT write preliminary hypotheses or premature conclusions in the scratchpad. It is a strict Chain of Evidence.
  2. Review Domain Hints: Read the Domain Hints in each file to get a high-level overview of what techniques are possible. Make sure to use this baseline knowledge when researching and retrieving hints during the ongoing investigation.
  3. Review SQL Reference: Read the SQL reference in references/sql.md and follow its Execution Protocol for all SQL generation. Do not guess schemas.
  4. Target Resolution: If the user’s request is broad (e.g., “why is the app slow?”) and doesn’t specify a package name:
    • Execute a query to identify the active application: sql INCLUDE PERFETTO MODULE android.startup.startups; SELECT package FROM android_startups;
    • If multiple packages are returned, ask the user to choose one. Save the chosen package_name to your scratchpad.

Investigation Protocol

Follow this iterative loop until you have isolated the definitive root cause(s):

1. Formulate Hypothesis

2. Plan and Collect Data

3. Analyze and Drill Down (Depth-First)

4. Exhaustive Investigation (Do Not Give Up Early)

Final Report

Only when you have followed the entire chain of dependencies to the root cause(s) AND confirmed through exhaustive search that no other major bottlenecks exist: 1. Summarize your findings detailing the verified chain of evidence. 2. Conclude with: “This concludes the trace analysis. You can review the full chain of evidence in [scratchpad_filename]. Let me know if you would like me to drill down into any of these specific threads, or if you’d like help drafting a bug report.”

Skill frontmatter

license: Complete terms in LICENSE.txt metadata: {"author"=>"Google LLC", "last-updated"=>"2026-05-14", "keywords"=>["Perfetto", "trace analysis", "Android performance", "debugging", "profiling", "jank", "bottleneck", "SQL"]}