perfetto-sql

perfetto-sql is a skill for Claude Code, Codex from tmolavi/mcp-agent-skills-hub. It costs 50 tokens per session (2,568 once invoked), scanned A, a copy of perfetto-sql, MIT.

A tool for turning plain-language questions into Perfetto SQL queries and running them on Android performance trace files. Perfetto traces record timing, threads, memory, and other system activity.

In plain words
What is it for?
Use it to find slices, thread activity, memory data, and timing relationships in Android traces.
Why use it?
It lets you inspect trace data without manually writing every query, while accounting for details such as unfinished events and overlapping time ranges.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to find slices, thread activity, memory data, and timing relationships in Android traces.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmolavi/mcp-agent-skills-hub/perfetto-sql
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tmolavi/mcp-agent-skills-hub --skill perfetto-sql
Clone the repo
git clone --depth 1 https://github.com/tmolavi/mcp-agent-skills-hub

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for perfetto-sql

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmolavi/mcp-agent-skills-hub/perfetto-sql/github.svg)](https://agentmods.dev/skills/tmolavi/mcp-agent-skills-hub/perfetto-sql)
Your own site
<a href="https://agentmods.dev/skills/tmolavi/mcp-agent-skills-hub/perfetto-sql"><img src="https://agentmods.dev/badge/skills/tmolavi/mcp-agent-skills-hub/perfetto-sql/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for perfetto-sql

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmolavi/mcp-agent-skills-hub/perfetto-sql"><img src="https://agentmods.dev/badge/skills/tmolavi/mcp-agent-skills-hub/perfetto-sql.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,568 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 95% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00050 $0.02568
Opus 5 $0.00025 $0.01284
Sonnet 5 $0.00010 $0.00514
Haiku 4.5 $0.00005 $0.00257

Measured 9d ago against content hash 13e701190c52, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

perfetto-sql scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

Perform a direct file check at the top level of your workspace (e.g., `ls trace_processor`). If missing, download `https://get.perfetto.dev/trace_processor` directly into the root workspace (`curl -LO`), make it executab
Origin

This is a copy

95% identical to perfetto-sql — 2 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/perfetto-sql/SKILL.md · 143 lines

How it starts

The opening of the file, as written. The whole thing — 143 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Guidelines and Hints

  • Idempotency: Ensure queries are idempotent to prevent "already exists" errors during multiple executions.

    • For Perfetto objects, always use CREATE OR REPLACE: CREATE OR REPLACE PERFETTO TABLE, CREATE OR REPLACE PERFETTO VIEW, CREATE OR REPLACE PERFETTO FUNCTION, CREATE OR REPLACE PERFETTO MACRO.
    • For SQLite Virtual Tables (such as SPAN_JOIN), CREATE OR REPLACE is not supported. Explicitly drop them first: DROP TABLE IF EXISTS my_table; CREATE VIRTUAL TABLE my_table USING SPAN_JOIN(...);
    • For standard SQLite indexes, prepend DROP INDEX IF EXISTS index_name;.
  • SPAN_JOIN will crash if intervals within the same input table overlap. Always use the PARTITIONED {column} (for example, PARTITIONED upid) clause to isolate intervals.

  • Intermediate tables fed into a SPAN_JOIN must be materialized using CREATE PERFETTO TABLE, not CREATE VIEW.

  • Trace Boundaries (dur = -1): Slices or thread states that don't finish before the trace ends are recorded with dur = -1. When calculating a bounding box (for example, ts + dur) or summing durations (SUM(dur)), handle incomplete durations using: IIF(dur = -1, trace_end() - ts, dur).

  • Robust State Transitions: Avoid manual timestamp arithmetic (for example, ts + dur = next.ts) to join adjacent events. Rely on standard library modules (for example, sched.runnable, linux.perf.counters, intervals.overlap) which safely handle trace gaps and preemptions.

  • Unique Identifiers: When writing SQL queries in Perfetto, you must join tables using utid (unique thread ID) or upid (unique process ID) instead of the regular tid or pid. Why it's useful : The operating system recycles TIDs and PIDs, while UTIDs and UPIDs remain unique for the lifetime of the trace, which prevents incorrect joins.

  • Safe Argument Extraction: Use EXTRACT_ARG(arg_set_id, 'key') to extract dictionary or JSON-like properties from slices or tracks. Don't attempt string parsing.

  • String Matching (Always use GLOB): Use GLOB instead of LIKE. LIKE causes performance bottlenecks and treats underscores (_) as wildcards, leading to bugs.

    • Exact matches: Use =.
    • Substring matches: Use GLOB with * (for example, name GLOB '*RenderThread*').
    • Case-insensitive matches: Use LOWER(name) GLOB and make sure the search string is fully lowercase (for example, LOWER(name) GLOB '*renderthread*'). Use this when dealing with inconsistent trace capitalization (for example, WakeLock versus wakelock).
  • Calculating Time Overlaps: To calculate the overlap duration between two time intervals [start1, end1] and [start2, end2]:

    Precedence Rule: Always prefer using SPAN_JOIN or standard library functions (for example, intervals.overlap) to calculate overlaps between two different sets of intervals . Avoid manual arithmetic if a standard library feature or SPAN_JOIN can achieve the same result. Use the following logic if no built-in alternative exists.

    1. Condition: The intervals overlap if start1 < end2 and start2 < end1.

    2. Duration: The overlap duration is calculated as MIN(end1, end2) - MAX(start1, start2)

      Important: Incomplete Perfetto slices have a duration of -1 (dur = -1). Always calculate the effective end time using ts + IIF(dur = -1, trace_end() - ts, dur) before applying this logic.

  • Query android_thread_slices_for_all_startups for app startup requests.

  • Join counter_track with counter to get values of counter with a specific name.

  • When querying for a CPU frequency counter, include the linux.cpu.frequency module and use the cpu_frequency_counters table.

  • When looking for events around a specific timestamp, start with 100ms as the window size.

  • Always prefix column names with table or view alias, that is: {alias}.{column_name}.

  • To calculate the total time spent in slices matching a specific name pattern (for example, *{name_pattern}*), you must sum their durations. Why it's useful : This helps quantify the total impact of a specific function or feature on performance across multiple calls. Here is an example query (note the safe handling of incomplete slices): sql SELECT count(*) as total_count, sum(IIF(slice.dur = -1, trace_end() - slice.ts, slice.dur)) / 1000000.0 as total_dur_ms FROM slice WHERE slice.name GLOB '*{name_pattern}*';

Read the full file on GitHub · 143 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 143 lines · 50 tokens per session scan A 13e701190c52

Subscribe to this mod's changes

perfetto-sql is a skill published in the GitHub repository tmolavi/mcp-agent-skills-hub (8 stars, last pushed 16d ago), licensed MIT. It adds 50 tokens to every session and 2,568 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). It is 95% identical to perfetto-sql, differing in 2 lines, and is treated as a copy.

Related

Other skills, from other repositories

incident-response

When something breaks in production: triage the severity, gather evidence, identify root cause, deploy a fix or mitigation, and write a post-mortem. Provides a calm, structured process for high-stress moments.

omergocmen/vibe-coder-kit · 47 tokens

incident-postmortem

Write blameless incident postmortems with timeline reconstruction, root cause analysis, action items, and preventive measures.

w95/awesome-claude-corporate-skills · 27 tokens

langsmith-fetch

Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio. Use when debugging agent behavior, investigating errors, analyzing tool calls, checking memory operations, or examining agent performance. Automatically fetches recent traces and analyzes execution patterns. Requires…

w95/awesome-claude-corporate-skills · 59 tokens

data-validation

QA an analysis before sharing with stakeholders — methodology checks, accuracy verification, and bias detection. Use when reviewing an analysis for errors, checking for survivorship bias, validating aggregation logic, or preparing documentation for reproducibility.

w95/awesome-claude-corporate-skills · 46 tokens

escalation

Structure and package support escalations for engineering, product, or leadership with full context, reproduction steps, and business impact. Use when an issue needs to go beyond support, when writing an escalation brief, or when assessing whether an issue warrants escalation.

w95/awesome-claude-corporate-skills · 53 tokens

clean-code-reviewer

Eliminates technical debt using SOLID, DRY, YAGNI, and Addy Osmani production-grade engineering principles. / TR: SOLID, DRY, YAGNI ve Addy Osmani üretim seviyesi mühendislik ilkeleri ile kod kalitesini denetleyen yetenek.

GktuOktay/ai-skills · 68 tokens