perfetto-sql

Translate natural language intents into Perfetto SQL queries and execute them on local trace files.

Updated May 22, 2026
One-click install
npx skills add https://github.com/ekawijayasusilo/kmp_template --skill perfetto-sql-ekawijayasusilo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: perfetto-sql
Source: https://github.com/ekawijayasusilo/kmp_template/tree/main/.claude/skills/perfetto-sql
Command: npx skills add https://github.com/ekawijayasusilo/kmp_template --skill perfetto-sql-ekawijayasusilo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It converts natural-language performance questions into valid Perfetto SQL and runs them against your local trace file so you can extract the slice, thread, or memory evidence you need without hand-writing fragile queries.

Core Features & Use Cases

  • Natural-language to Perfetto SQL: Drafts syntactically valid Perfetto SQL that follows query safety rules and Perfetto-specific constraints.
  • Trace_processor execution & CSV output: Uses the Perfetto trace_processor wrapper to execute the query against a local trace and return results in CSV form.
  • Perfetto-specific correctness guardrails: Enforces practices like idempotent CREATE OR REPLACE, safe handling of incomplete slices (dur = -1), and safe joins using utid/upid.

Use case: you want to understand startup performance impact by extracting time spent in specific slice patterns across requests and aggregating the total duration safely even when some slices are incomplete.

Quick Start

Run the perfetto-sql skill on your Perfetto trace and ask for the slice total duration for a specific function name pattern, such as "total time spent in slices matching RenderThread."

Frequently Asked Questions about perfetto-sql

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

FAQPage Schema
How do I query Perfetto traces using natural language instead of writing SQL?

You can query Perfetto traces by translating natural language data intents into syntactically valid Perfetto SQL. The skill executes these queries locally against your trace file via trace_processor to extract slice, thread, and memory evidence.

What's the best way to analyze Android startup performance from a Perfetto trace?

Analyzing Android startup performance from a Perfetto trace is done by generating SQL queries that extract time spent in specific slice patterns across requests. The skill safely aggregates total duration even when slices are incomplete, targeting startup-focused profiling workflows.

Can I run trace analysis queries locally and get CSV output from Perfetto traces?

Yes, you can run trace analysis queries locally and get CSV output. The skill uses the Perfetto trace_processor wrapper to execute generated SQL against a local trace file and returns the extracted performance profiling results in CSV form.

How does Perfetto SQL handle incomplete slices with dur equal to -1?

Perfetto SQL handles incomplete slices by applying safe processing rules for dur = -1 boundaries. The skill enforces these correctness guardrails during query generation to prevent errors when aggregating durations for slices that have not finished recording.

Why does Perfetto SQL require safe SPAN_JOIN usage with partitioning and utid or upid joins?

Perfetto SQL requires safe SPAN_JOIN usage with partitioning and utid/upid joins to ensure correct data relationships. The skill enforces these Perfetto-specific constraints and idempotent object creation rules to generate syntactically valid and safe queries.