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.
npx skills add tmolavi/mcp-agent-skills-hub --skill perfetto-sqlgit clone --depth 1 https://github.com/tmolavi/mcp-agent-skills-hubWrote 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.
[](https://agentmods.dev/skills/tmolavi/mcp-agent-skills-hub/perfetto-sql)<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.
<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>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00050 | $0.02568 |
| Opus 5.5 | $0.00020 | $0.01027 |
| Sonnet 5.5 | $0.00010 | $0.00514 |
| Haiku 4.5 | $0.00005 | $0.00257 |
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 2mo 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 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.
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 REPLACEis 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;.
- For Perfetto objects, always use
-
SPAN_JOINwill crash if intervals within the same input table overlap. Always use thePARTITIONED {column}(for example,PARTITIONED upid) clause to isolate intervals. -
Intermediate tables fed into a
SPAN_JOINmust be materialized usingCREATE PERFETTO TABLE, notCREATE VIEW. -
Trace Boundaries (
dur = -1): Slices or thread states that don't finish before the trace ends are recorded withdur = -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) orupid(unique process ID) instead of the regulartidorpid. Why it's useful : The operating system recyclesTIDsandPIDs, whileUTIDsandUPIDsremain 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
GLOBinstead ofLIKE.LIKEcauses performance bottlenecks and treats underscores (_) as wildcards, leading to bugs.- Exact matches: Use
=. - Substring matches: Use
GLOBwith*(for example,name GLOB '*RenderThread*'). - Case-insensitive matches: Use
LOWER(name) GLOBand make sure the search string is fully lowercase (for example,LOWER(name) GLOB '*renderthread*'). Use this when dealing with inconsistent trace capitalization (for example,WakeLockversuswakelock).
- Exact matches: Use
-
Calculating Time Overlaps: To calculate the overlap duration between two time intervals
[start1, end1]and[start2, end2]:Precedence Rule: Always prefer using
SPAN_JOINor standard library functions (for example,intervals.overlap) to calculate overlaps between two different sets of intervals . Avoid manual arithmetic if a standard library feature orSPAN_JOINcan achieve the same result. Use the following logic if no built-in alternative exists.-
Condition: The intervals overlap if
start1 < end2andstart2 < end1. -
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 usingts + IIF(dur = -1, trace_end() - ts, dur)before applying this logic.
-
-
Query
android_thread_slices_for_all_startupsfor app startup requests. -
Join
counter_trackwithcounterto get values of counter with a specific name. -
When querying for a CPU frequency counter, include the
linux.cpu.frequencymodule and use thecpu_frequency_counterstable. -
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}*';
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.
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.
- 2mo ago First seen · 143 lines · 50 tokens per session scan A 13e701190c52
perfetto-sql is a skill published in the GitHub repository tmolavi/mcp-agent-skills-hub (11 stars, last pushed 3d ago), licensed MIT. It adds 50 tokens to every session and 2,568 once invoked, about $0.0002 per session on Opus 5.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.
perfetto-sql compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| perfetto-sqltmolavi/mcp-agent-skills-hub | Skill | 11 | 3d ago | MIT | A | 50 | Claude Code, Codex |
| doubt-driven-developmentaddyosmani/agent-skills | Skill | 122k | 6d ago | MIT | A | 96 | Claude Code |
| performance-optimizationaddyosmani/agent-skills | Skill | 122k | 6d ago | MIT | A | 59 | Claude Code |
| debugging-and-error-recoveryaddyosmani/agent-skills | Skill | 122k | 6d ago | MIT | A | 129 | Claude Code |
| error-handlingDevelopersGlobal/ai-agent-skills | Skill | 220 | 5d ago | MIT | A | 32 | Claude Code, Codex |
| agent-qa-run-reviewDevelopersGlobal/ai-agent-skills | Skill | 220 | 5d ago | MIT | A | 34 | Claude Code, Codex |
| debugging-methodologyDevelopersGlobal/ai-agent-skills | Skill | 220 | 5d ago | MIT | A | 26 | Claude Code, Codex |