hz-android-2d-porting
Guides porting existing Android 2D apps to Meta VR and Horizon OS — input adaptation, panel layout, and design requirements. Use…
Analyzes Meta VR 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 Meta VR devices. Build paths: all Meta VR app stacks; use hz-quest-verify-first if the build
Claude Code
$ npx -y skills add meta-quest/agentic-tools --skill hz-perfetto-debug --agent claude-code
Codex
$ npx skills add meta-quest/agentic-tools --skill hz-perfetto-debug -a codex -y
Cursor
$ npx skills add meta-quest/agentic-tools --skill hz-perfetto-debug -a cursor -y
Gemini CLI
$ npx skills add meta-quest/agentic-tools --skill hz-perfetto-debug -a gemini-cli -y
GitHub Copilot
$ npx skills add meta-quest/agentic-tools --skill hz-perfetto-debug -a github-copilot -y
OpenCode
$ npx skills add meta-quest/agentic-tools --skill hz-perfetto-debug -a opencode -y
Windsurf
$ npx skills add meta-quest/agentic-tools --skill hz-perfetto-debug -a windsurf -y
name: hz-perfetto-debug license: Apache-2.0 description: "Analyzes Meta VR 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 Meta VR devices. Build paths: all Meta VR app stacks; use hz-quest-verify-first if the build path is unclear." allowed-tools: Bash(metavr:*), Bash(hzdb:*), Bash(npx:*)
Use this skill when investigating VR performance issues on Meta VR devices:
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 Rate | Frame Time Budget | Notes | |-------------|------------------|-------| | 120 Hz | 8.3 ms | Supported on Quest 2, Quest 3, Quest 3S | | 90 Hz | 11.1 ms | Supported on Quest 2, Quest Pro, Quest 3, Quest 3S | | 72 Hz | 13.9 ms | Default on all Quest devices | | 60 Hz | 16.7 ms | Media 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.
Perfetto tracing is powered by the metavr CLI — install the standalone binary on your PATH (see the `metavr-cli` skill), or invoke via `npx` with no install:
metavr --version
Examples below use the bare `metavr` command; if you use the npm distribution, prefix with `npx -y`. Connect your Meta VR device via USB with developer mode enabled before capturing traces.
# 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.
metavr perf traces
Returns `.pftrace` files sorted by modification time (newest first). Searches standard directories including `~/Documents`, `~/Downloads`, and the current working directory.
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.
metavr perf context
Returns a structured performance analysis including:
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.
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.
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.
Follow these steps in order for a thorough performance investigation.
Before analyzing, confirm the trace is usable:
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`.
Find the application process (not system services):
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.
Look for engine-specific markers:
| Engine | Key Markers | |--------|------------| | Unity | `PlayerLoop`, `UnityMain`, `PhaseSync`, `PostLateUpdate.FinishRendering` | | Unreal | `UGameEngine::Tick`, `FEngineLoop::Tick`, `RHI Thread` | | Native OpenXR | `xrWaitFrame`, `xrBeginFrame`, `xrEndFrame` without engine markers |
Identify the threads that matter for VR rendering:
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
Cri
Guides porting existing Android 2D apps to Meta VR and Horizon OS — input adaptation, panel layout, and design requirements. Use…
Upgrades Meta VR apps to newer Horizon OS SDK versions — migration guides, deprecated API replacements, changelog. Use when…
Guides design of comfortable, intuitive VR/MR experiences for Meta VR and Horizon OS — comfort guidelines, interaction patterns,…
Builds WebXR experiences for Meta VR and Horizon OS using the Immersive Web SDK (IWSDK) — ECS architecture, Three.js integration,…
Build multi-window Meta Horizon OS experiences with the MetaVrx Layout SDK in Jetpack Compose or React Native. Covers framework…
Builds app UI for Meta VR and Horizon OS with the MetaVrx UI Set, a Jetpack Compose component library and design system. Covers…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.