hz-simpleperf-debug

使用 simpleperf 对 Meta Quest 和 Horizon OS 应用的 CPU 性能进行剖析,包括工作负载分类、CPU 热点记录及内核开销测量。适用于诊断 Quest 设备上的应用是受 CPU 限制、内存限制还是 I/O 限制。

仓库最近推送
GitHub Stars
269
Forks
25
Issues / PRs
8

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "hz-simpleperf-debug":https://skillpi.com/zh/skills/deepskill-9a669e6d04bbbf4c0e2363ce5fe4afa64d5f150b6a6753b4a87c3eaed2b8b5f6。安装前核对上游来源和版本:https://github.com/meta-quest/agentic-tools。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

使用 simpleperf 对 Meta Quest 和 Horizon OS 应用的 CPU 性能进行剖析,包括工作负载分类、CPU 热点记录及内核开销测量。适用于诊断 Quest 设备上的应用是受 CPU 限制、内存限制还是 I/O 限制。

0 下载

介绍来源: third_party · meta-quest · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
软件、账号及付费要求
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: hz-simpleperf-debug
license: Apache-2.0
description: "Profiles Meta VR and Horizon OS application CPU performance using simpleperf — workload classification, CPU hotspot recording, kernel overhead measurement. Use when diagnosing whether an app is CPU-bound, memory-bound, or I/O-bound 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:*)

Simpleperf Debug Skill

When to Use

Use this skill when you need hardware-level CPU performance insights on Meta VR devices:

  • Classifying whether an app is CPU-bound, memory-bound, or I/O-bound
  • Finding CPU hotspot functions consuming the most cycles
  • Measuring kernel vs userspace CPU overhead per thread
  • Identifying cache-thrashing or branch-prediction issues
  • Supplementing Perfetto trace analysis with hardware PMU counter data

This skill complements hz-perfetto-debug. Perfetto shows what your app is doing over time. Simpleperf shows where the CPU is spending hardware cycles — cache misses, branch mispredictions, and instruction throughput that Perfetto can't see.

VR Performance Context

Meta VR devices run on mobile ARM SoCs with strict thermal and power budgets. CPU-bound apps hit frame drops when:

Refresh Rate CPU Frame Budget Notes
120 Hz 8.3 ms Tight — simpleperf critical for finding hotspots
90 Hz 11.1 ms Default target for most apps
72 Hz 13.9 ms Fallback for heavier apps

Simpleperf's hardware counters reveal bottlenecks invisible to software tracing.

metavr Setup

Simpleperf profiling 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.

Quick Start Workflow

1. Classify the Workload

Before optimizing, determine the bottleneck type:

# Classify the foreground app's workload (10-second sample)
metavr perf simpleperf classify

# Target a specific app
metavr perf simpleperf classify --app com.example.myapp

# Custom duration
metavr perf simpleperf classify --duration 15

Returns a classification with evidence:

Classification Indicator Optimization Strategy
CPU-bound High IPC, low stall ratio Optimize algorithms, reduce draw calls, batch work
Memory-bound High stall ratio (stalled-cycles-backend / cpu-cycles) Reduce cache misses, improve data locality, shrink working set
I/O-bound High context switches per second Reduce blocking I/O, use async, minimize thread contention

2. Record CPU Hotspots

Capture a CPU cycle profile to find the most expensive functions:

# Record CPU hotspots for the foreground app
metavr perf simpleperf record

# Custom frequency and duration
metavr perf simpleperf record --frequency 4000 --duration 10

# Target a specific app
metavr perf simpleperf record --app com.example.myapp

The recording samples CPU cycles at the specified frequency (default 4000 Hz) and generates a profile showing which functions consume the most CPU time.

3. Measure Kernel Overhead

Determine how much CPU time is spent in kernel vs userspace per thread:

# Measure kernel overhead for the foreground app
metavr perf simpleperf kernel-overhead

# Custom duration
metavr perf simpleperf kernel-overhead --app com.example.myapp --duration 10

Returns per-thread breakdown of user-mode vs kernel-mode CPU cycles. High kernel overhead (>20%) in a thread suggests:

  • Excessive syscalls (file I/O, memory allocation)
  • Driver overhead (GPU command submission, sensor access)
  • Lock contention in kernel synchronization primitives

Analysis Workflow

Step 1: Classify First

Always start with classification. This prevents wasting time optimizing the wrong thing.

metavr perf simpleperf classify --app com.example.myapp --duration 10

Decision tree based on results:

  • CPU-bound → Record hotspots (Step 2a), look at top functions
  • Memory-bound → Record with cache-miss events, check data access patterns
  • I/O-bound → Check kernel overhead, look at thread contention in Perfetto

Step 2a: CPU-Bound Apps — Find Hotspots

metavr perf simpleperf record --app com.example.myapp --duration 10

Review the top functions by CPU cycle consumption. Common VR hotspots:

Function Pattern Likely Cause Fix
Physics.* / PhysX Complex physics simulation Reduce collider count, simplify meshes, increase fixed timestep
Render* / Draw* Too many draw calls Batch materials, use GPU instancing, reduce unique materials
GC_* / gc_alloc Garbage collection pressure Pool allocations, avoid per-frame allocations
memcpy / memmove Large data copies Use references, reduce buffer sizes, avoid unnecessary copies
LZ4_* / compress Asset decompression Pre-decompress, use lighter compression, cache results

Step 2b: Memory-Bound Apps — Check Cache Behavior

If classification shows memory-bound, the issue is likely cache misses or memory bandwidth:

  • Large working sets thrashing L1/L2 cache
  • Random access patterns defeating prefetcher
  • False sharing between threads on adjacent cache lines

Use Perfetto hz-perfetto-debug to correlate memory-bound regions with specific code paths.

Step 3: Measure Kernel Overhead

metavr perf simpleperf kernel-overhead --app com.example.myapp

Interpreting results by thread:

Thread Expected Kernel % High Kernel % Indicates
Main/Game thread < 5% Excessive file I/O, logging, or allocations
Render thread 5-15% Normal (GPU driver overhead). >20% = driver issue
Worker threads < 5% Thread synchronization overhead
Audio thread < 10% Normal for audio HAL calls

Step 4: Combine with Perfetto

Simpleperf tells you where cycles go. Perfetto tells you when and in what context. Use together:

  1. Simpleperf classification reveals the bottleneck type
  2. Simpleperf hotspot recording identifies the expensive functions
  3. Perfetto trace (metavr perf capture) shows when those functions run relative to frame boundaries
  4. Use metavr perf query to correlate function timing with frame drops

Common Pitfalls

  • Don't profile in thermal throttling. Let the device cool before recording — throttled clocks distort cycle counts. Check thermal state first with metavr device info.
  • Sample duration matters. Short recordings (<5s) may not capture representative behavior. Use at least 10 seconds for classification.
  • simpleperf requires shell access. If adb shell simpleperf fails, ensure developer mode is enabled and USB debugging is authorized.
  • Frequency vs accuracy tradeoff. Higher sampling frequency (>8000 Hz) can perturb the workload on mobile SoCs. Default 4000 Hz is a good balance.
  • Classification is a snapshot. An app can be CPU-bound during gameplay and I/O-bound during scene loads. Profile the specific scenario you're optimizing.

References

For detailed guides on specific topics, see:

版本历史

  1. v1.8.0 GitHub ↗
    原版更新说明

    **Full Changelog**: https://github.com/meta-quest/agentic-tools/compare/v1.2.3...v1.8.0

  2. v1.2.3 GitHub ↗
    原版更新说明

    **Full Changelog**: https://github.com/meta-quest/agentic-tools/compare/v1.2.1...v1.2.3

  3. v1.2.1 GitHub ↗
    原版更新说明

    **Full Changelog**: https://github.com/meta-quest/agentic-tools/commits/v1.2.1

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供针对 Meta VR 设备的专业 CPU 性能剖析能力
  • 直接解决 VR 开发中的核心瓶颈诊断需求
  • 工作流程清晰,从分类到热点分析的完整闭环
触发精准95/100

亮点

  • frontmatter description 清晰完整地描述了使用场景
  • When to Use 章节细化了具体触发条件
  • 边界清晰,不易与其他 Skill 混淆
结构规范95/100

待提升项

  • 引用文件缺失 原报告严重程度:轻微

    References 部分引用了 workload-classification.md、cpu-hotspot-analysis.md、kernel-overhead.md 三个文件,但未在传入内容中提供

    改进建议:建议提供被引用的参考文件,或将引用内容整合到主文档中

亮点

  • 文档结构完整,包含从快速入门到深度分析的完整流程
  • 每个步骤都有清晰的命令示例和解释
  • frontmatter 完整,符合规范
执行可靠90/100

亮点

  • 工具来源明确(metavr CLI),参数正确
  • 覆盖了主要异常情况和常见陷阱
  • Common Pitfalls 章节提供了实用的执行建议
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 36, 42 行

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

翻译待完成,请参阅来源文档。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。