Hz Perfetto Debug logo

Hz Perfetto Debug

Organization
meta-quest
hz-perfetto-debug

Analyzes Meta Quest and Horizon OS VR performance using Perfetto traces — frame timing, CPU/GPU bottlenecks, render pass analysis. Use when profiling frame drops, jank, or thermal issues on Quest devices.

Overview

Publishermeta-quest
Repositoryagentic-tools
Skill namehz-perfetto-debug
Stars
195
Forks
17
Bundled files
5
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 5 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by meta-quest on GitHub. Read the source before you install it.

Installation

Install the Hz Perfetto Debug AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/meta-quest/agentic-tools.git /tmp/agentic-tools
mkdir -p .claude/skills
cp -r /tmp/agentic-tools/skills/hz-perfetto-debug .claude/skills/hz-perfetto-debug
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Hz Perfetto Debug in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Hz Perfetto Debug on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Hz Perfetto Debug is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Perfetto Debug Skill

When to Use

Use this skill when investigating VR performance issues on Meta Quest devices:

  • Frame drops, jank, or stuttering
  • CPU or GPU bottlenecks
  • Render pass overhead and GPU utilization
  • Thermal throttling and clock frequency changes
  • Frame timing variance and missed vsync deadlines
  • Thread contention and synchronization issues
  • High draw call counts or overdraw

VR Frame Time Targets

These are the hard deadlines for each refresh rate. If a frame exceeds its target, the compositor must reproject or the user sees a stale frame.

Refresh RateFrame Time BudgetNotes
120 Hz8.3 msSupported on Quest 2, Quest 3, Quest 3S
90 Hz11.1 msSupported on Quest 2, Quest Pro, Quest 3, Quest 3S
72 Hz13.9 msDefault on all Quest devices
60 Hz16.7 msMedia apps only (Quest 2); interactive apps must use 72 Hz+

Missing a frame deadline by even 1 ms causes a stale frame (reprojection). Stale frames above 10% of total frames indicate a serious performance problem.

metavr Setup

Perfetto tracing is powered by the metavr CLI. Invoke via npx — no install required:

bash
npx -y metavr --version

Examples below use the bare metavr command for brevity; if it is not installed globally, replace metavr with npx -y metavr. Connect your Quest via USB with developer mode enabled before capturing traces.

Quick Start Workflow

1. Capture a Trace

bash
# Capture a 5-second trace from the currently running VR app
metavr perf capture

# Specify duration and target app
metavr perf capture --duration 10000 --app com.example.myapp

# Enable GPU render stage tracing for detailed pass analysis
metavr perf capture --gpu-render-stage

# Enable XR runtime metrics
metavr perf capture --xr-runtime

# Custom output name
metavr perf capture -o my-session-name

The capture auto-detects the foreground VR app if --app is not specified. CPU scheduling and GPU metrics tracing are enabled by default. The trace is pulled to your local machine automatically.

2. List Available Traces

bash
metavr perf traces

Returns .pftrace files sorted by modification time (newest first). Searches standard directories including ~/Documents, ~/Downloads, and the current working directory.

3. Load a Trace

bash
metavr perf load <trace-file>

Loads and processes the trace for analysis. Accepts a hex session ID, filename (with or without .pftrace extension), or a full/relative path.

4. Get Performance Overview

bash
metavr perf context

Returns a structured performance analysis including:

  • CPU and GPU frame timing statistics
  • Thread breakdown with utilization percentages
  • GPU counter summaries (if available)
  • Detected bottlenecks and recommendations

5. Run SQL Queries

bash
metavr perf query <session-id> "SELECT ts, dur, name FROM slice WHERE name LIKE '%PlayerLoop%' LIMIT 20"

Executes arbitrary SQL against the loaded Perfetto trace database. All Perfetto tables are available: slice, thread_track, thread, process, counter, counter_track, args, sched_slice, and more.

6. Analyze Thread States

bash
metavr perf thread-state <session-id> <utid>

# With time range
metavr perf thread-state <session-id> <utid> --start-ts 1000000 --end-ts 5000000000

Returns a thread state breakdown showing how much time the thread spent running, sleeping, blocked, or waiting for CPU. Useful for identifying whether a thread is CPU-bound, I/O-bound, or starved.

7. Get GPU Metrics

bash
metavr perf gpu-counters <session-id> --start-ts 100,200,300 --end-ts 150,250,350

Returns GPU metric counters (mean, standard deviation, quantiles) for GPU frame ranges. Requires at least 20 frames for statistical accuracy. Metrics include texture fetch rates, shader ALU capacity, vertex processing, and fragment shading statistics.

Detailed Analysis Workflow

Follow these steps in order for a thorough performance investigation.

Step 1: Validate Trace Quality

Before analyzing, confirm the trace is usable:

  • Duration: At least 2 seconds of data (ideally 3-5 seconds)
  • Slice count: Should have thousands of slices for a meaningful trace
  • Process presence: The target app process must be present
sql
SELECT
  (MAX(ts) - MIN(ts)) / 1e9 AS duration_seconds,
  COUNT(*) AS total_slices
FROM slice

If the trace has fewer than 1000 slices or is under 1 second, it may not contain enough data for meaningful analysis. Capture a new trace with metavr perf capture.

Step 2: Identify Target Process

Find the application process (not system services):

sql
SELECT upid, pid, name
FROM process
WHERE name NOT LIKE 'com.oculus%'
  AND name NOT LIKE '/system%'
  AND name NOT LIKE 'com.android%'
  AND name IS NOT NULL
ORDER BY pid

For known apps, filter directly by package name.

Step 3: Identify Game Engine

Look for engine-specific markers:

EngineKey Markers
UnityPlayerLoop, UnityMain, PhaseSync, PostLateUpdate.FinishRendering
UnrealUGameEngine::Tick, FEngineLoop::Tick, RHI Thread
Native OpenXRxrWaitFrame, xrBeginFrame, xrEndFrame without engine markers

Step 4: Find Key Threads

Identify the threads that matter for VR rendering:

sql
SELECT t.utid, t.tid, t.name, p.name AS process_name
FROM thread t
JOIN process p USING(upid)
WHERE p.name = '<target-process>'
ORDER BY t.name

Critical threads to locate:

ThreadPurpose
Main thread (UnityMain / GameThread)Game logic, physics, scripts
Render thread (UnityGfx / RenderThread)Draw call submission
GPU completion (GPU completion / RHI Thread)GPU fence waiting
Worker threads (Job.Worker / TaskGraph)Parallel workloads

Once you have a thread's utid, use metavr perf thread-state <session-id> <utid> to get a quick breakdown of its running/sleeping/blocked time.

Step 5: Detect Frame Boundaries

Find frame start/end markers to segment per-frame analysis:

  • Unity: PlayerLoop slices on the main thread define frame boundaries
  • Unreal: FEngineLoop::Tick slices on the game thread
  • OpenXR: xrWaitFrame to xrEndFrame sequences

Step 6: Analyze Expensive Functions

Find what consumes the most time per frame:

sql
SELECT name, COUNT(*) AS call_count, SUM(dur)/1e6 AS total_ms, AVG(dur)/1e6 AS avg_ms
FROM slice
WHERE track_id IN (
  SELECT id FROM thread_track WHERE utid = <main_thread_utid>
)
GROUP BY name
ORDER BY total_ms DESC
LIMIT 20

Step 7: Check High-Frequency Calls

Functions called excessively per frame can indicate batching issues:

sql
SELECT name, COUNT(*) AS calls
FROM slice
WHERE track_id IN (
  SELECT id FROM thread_track WHERE utid = <utid>
)
  AND dur < 100000
GROUP BY name
HAVING calls > 1000
ORDER BY calls DESC

Step 8: Analyze GPU Render Passes

See the GPU analysis reference for detailed render pass breakdown, surface analysis, and GPU counter interpretation.

Key Perfetto Concepts

ConceptDescription
SliceA timed span of execution (function call, frame, render pass). Has ts (start), dur (duration), name, and track_id.
TrackA timeline lane. Thread tracks hold slices for a specific thread. Counter tracks hold metric values over time.
Thread (utid)Unique thread ID within the trace. Use utid (not tid) for joins — tid can be reused.
Process (upid)Unique process ID within the trace. Use upid (not pid) for joins.
TimestampsAll timestamps are in nanoseconds. Divide by 1e6 for milliseconds, 1e9 for seconds.
CounterA time-series metric (GPU utilization, clock frequency, temperature). Stored in the counter table.
ArgsKey-value metadata attached to slices. Accessed via the args table joined on arg_set_id.

Performance Targets

MetricTargetWarningCritical
Frame time (90 Hz)< 11.1 ms> 11.1 ms> 16.7 ms
Stale frame rate< 5%> 10%> 25%
Main thread utilization< 80% of budget> 80%> 95%
GPU utilization< 85% of budget> 85%> 95%
Frame variance (std dev)< 1 ms> 2 ms> 4 ms
Draw calls per frame< 100> 200> 500

Engine-Specific Notes

Unity

  • PhaseSync: VR vsync alignment mechanism. Appears as idle time at the start of PlayerLoop. This is normal and intentional — do NOT flag as wasted time.
  • Single-pass multiview: Both eyes rendered in one pass. If you see two render passes per frame, the app may be using multi-pass rendering (less efficient).
  • Dynamic batching: Watch for high SetPass call counts, which indicate materials are not being batched.
  • IL2CPP vs Mono: IL2CPP builds have different function naming in traces. Look for mangled C++ names instead of C# method names.

Unreal Engine

  • RHI Thread: Unreal uses a separate RHI (Render Hardware Interface) thread for GPU command submission. Check this thread for driver overhead.
  • Forward vs Deferred: Forward rendering is preferred on Quest. Deferred rendering has significantly higher GPU cost.
  • Blueprint Tick: Heavy Blueprint usage shows up as UObject::ProcessEvent. High counts indicate Blueprints should be converted to C++.
  • Nativized Blueprints: Show up with __StaticExec suffix in trace names.

Common Pitfalls

  • Do NOT report PhaseSync or xrWaitFrame idle time as a performance problem — these are intentional frame pacing mechanisms.
  • GPU render pass names like surface#0 are not descriptive — correlate them with the resolution and MSAA level to identify what they render.
  • Thread names can be truncated in traces. UnityMain may appear as UnityMai or similar.
  • Always use utid (not tid) when joining thread-related tables in SQL queries.
  • Timestamps are nanoseconds. A common mistake is treating them as microseconds.
  • Counter values are instantaneous samples, not averages over a period.

References

For detailed guides on specific topics, see:

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Hz Perfetto Debug AI skill do?

Analyzes Meta Quest and Horizon OS VR performance using Perfetto traces — frame timing, CPU/GPU bottlenecks, render pass analysis. Use when profiling frame drops, jank, or thermal issues on Quest devices.

Why use Hz Perfetto Debug on TypingMind?

Because you install it once and use it with any model. Hz Perfetto Debug is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Hz Perfetto Debug in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/meta-quest/agentic-tools/tree/main/skills/hz-perfetto-debug. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Hz Perfetto Debug?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Hz Perfetto Debug?

As many as you like. As long as a model supports skills, you can use Hz Perfetto Debug with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Hz Perfetto Debug AI skill free?

Yes. It is published on GitHub by meta-quest under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇