https://developer.android.com/agents/skills/profilers/perfetto-sql/skill

Generate and validate PerfettoSQL queries for Android trace performance analysis.

5|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/fornewid/android-developers-changelog --skill https-developer-android-com-agents-skills-profilers-perfetto-sql-skill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: https://developer.android.com/agents/skills/profilers/perfetto-sql/skill
Source: https://github.com/fornewid/android-developers-changelog/tree/main/docs/agents/skills/profilers/perfetto-sql
Command: npx skills add https://github.com/fornewid/android-developers-changelog --skill https-developer-android-com-agents-skills-profilers-perfetto-sql-skill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires trace_processor, and includes references (resource) components.

What problem does it solve?

It helps you write correct, reliable SQL queries against Perfetto trace data so you can analyze performance and profiling signals without brittle query logic or unsafe assumptions.

Core Features & Use Cases

  • PerfettoSQL query guardrails: Enforces idempotent object creation rules (CREATE OR REPLACE, safe drops for virtual tables) to prevent re-run failures.
  • Correct time and interval handling: Provides guidance for incomplete slices (dur = -1) and safe overlap logic using standards/library features (including SPAN_JOIN/intervals.overlap precedence).
  • Trace-specific correctness: Advises correct join keys (utid/upid), safe argument extraction (EXTRACT_ARG), and safe string matching (GLOB instead of LIKE) for performance and accuracy.
  • Execution protocol: Runs queries via the trace_processor wrapper with --query-string and validates schema/module usage against the Perfetto Standard Library docs.

Quick Start

Ask the agent to generate and execute a validated trace_processor SQL query for your specific Perfetto performance question, using the Perfetto Standard Library schemas for every referenced table or view.

Frequently Asked Questions about https://developer.android.com/agents/skills/profilers/perfetto-sql/skill

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

FAQPage Schema
How do I write valid SQL queries for Perfetto trace analysis?

To write valid Perfetto trace analysis SQL, you must use the Perfetto Standard Library schemas for every referenced table or view, enforce idempotent CREATE OR REPLACE patterns, and execute validated queries via trace_processor.

What is the best way to handle incomplete slices and interval overlaps in PerfettoSQL?

Handling incomplete slices and interval overlaps in PerfettoSQL requires checking for dur = -1 and using safe overlap logic with standards library features like SPAN_JOIN and intervals.overlap precedence.

Why does my PerfettoSQL query fail when extracting arguments or joining thread data?

PerfettoSQL query failures during argument extraction or thread joins often occur from unsafe assumptions; use EXTRACT_ARG for arguments, ensure correct join keys like utid/upid, and use GLOB instead of LIKE for string matching.

How do I safely re-run PerfettoSQL queries without dropping virtual tables manually?

To safely re-run PerfettoSQL queries without manual drops, apply idempotent object creation rules using CREATE OR REPLACE and implement safe drop patterns for virtual tables to prevent re-run failures.

Can I use trace_processor to validate schema and module usage before executing PerfettoSQL?

Yes, you can use trace_processor to validate schema and module usage before executing PerfettoSQL by running queries via the trace_processor wrapper with --query-string and validating against Perfetto Standard Library docs.

What are the limitations when handling trace time boundaries in Perfetto SQL validation?

Perfetto SQL validation limitations involve trace boundary handling across typical trace time windows; queries must account for incomplete slices and avoid brittle logic by adhering to trace-specific safety rules.