perfetto-sql

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

174|8|Updated Jan 9, 2024
One-click install
npx skills add https://github.com/klxiaoniu/QQVersionList --skill perfetto-sql-klxiaoniu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: perfetto-sql
Source: https://github.com/klxiaoniu/QQVersionList/tree/main/.agents/skills/perfetto-sql
Command: npx skills add https://github.com/klxiaoniu/QQVersionList --skill perfetto-sql-klxiaoniu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you turn natural-language trace questions into valid Perfetto SQL that extracts the exact timing and slice/thread/memory data you need from Android Perfetto traces.

Core Features & Use Cases

  • Natural-language to Perfetto SQL: Convert intent into syntactically correct SQL for Perfetto trace_processor.
  • Guided, safe querying practices: Uses robust join keys (utid/upid), enforces GLOB vs LIKE, and handles incomplete slices where dur = -1.
  • Operational extraction from trace files: Executes the generated queries against a local trace file to return results as CSV.
  • Use Case: Diagnose app startup or performance regressions by extracting total time spent in specific slice patterns, or analyzing runnable scheduling and counters around a timestamp.

Quick Start

Ask: "Extract the total time spent in slices whose name matches 'RenderThread' from the provided Perfetto trace, handling incomplete durations correctly."

Frequently Asked Questions about perfetto-sql

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

FAQPage Schema
How do I write SQL queries to analyze Android Perfetto traces?

To analyze Android Perfetto traces with SQL, you translate natural language intents into syntactically valid queries and execute them against a local trace file via the trace_processor. This allows you to extract timing, slice, and thread scheduling data directly.

What is the best way to extract total time spent in specific slices from a Perfetto trace?

The best way to extract total time spent in specific slices is by converting your intent into a Perfetto SQL query that aggregates slice durations. It enforces safe querying practices, including handling incomplete slices where duration equals -1.

How does span_join work for thread scheduling analysis in Perfetto?

Span_join in Perfetto works by joining tables based on overlapping time intervals to analyze thread scheduling. It requires strict use of schema-discovered tables, correct module includes, and robust join keys like utid or upid for accurate trace analysis.

Can I use natural language to query counter and CPU frequency data from an Android trace?

Yes, you can use natural language to query counter and CPU frequency data from an Android trace. The process translates your intent into valid Perfetto SQL, executing counter lookups and event inspections around specific timestamps via the trace_processor.

Why should I use GLOB instead of LIKE for string matching in Perfetto SQL?

You should use GLOB instead of LIKE for string matching in Perfetto SQL because the guided querying practices enforce GLOB-based syntax for pattern matching. This ensures syntactic correctness when filtering slices by name, such as matching RenderThread events.