XR VR AR monado oculus quest pico性能分析工具综述
admin
2023-10-03 22:22:19
0
monado性能分析系列文章索引汇总:
XR VR AR monado oculus quest pico性能分析工具综述
Monado timing frame pacing frame timing 时间点分析
monado metrics tool离线性能指标工具分析
vr ar xr monado性能分析工具 percetto编译和monado集成

总体说明

本文是XR性能分析综述,包含Monado Oculus Pico的性能分析方法介绍,关于Monado性能分析的详细介绍,参加后续博文。

Monado性能分析工具

Metrics

源码库

https://gitlab.freedesktop.org/monado/utilities/metrics

指标定义和写入

https://gitlab.freedesktop.org/monado/monado/-/blob/main/doc/metrics.md

@monado/src/external/naopb/monado_metrics.pb.h
@monado/src/xrt/auxiliary/util/u_metrics.c 指标数据写入到pb文件
@u_pacing_compositor.c
-> do_metrics() -> u_metrics_write_system_present_info()
-> pc_info_gpu() -> u_metrics_write_system_gpu_info()
-> pc_predict() -> m_metrics_write_system_frame()
@u_pacing_app.c
-> do_metrics() -> u_metrics_write_session_frame()
-> pa_latached() -> u_metrics_write_used()

Running

Launch the service with the env variable `XRT_METRICS_FILE` set.

XRT_METRICS_FILE=/path/to/file.protobuf monado-service

读取指标pb文件,可视化

参加metrics源码cmd.py脚本

RenderDoc

通常,renderdoc通过hook present函数来捕获帧,以识别应用程序何时完成了帧的渲染。

OpenXR应用程序可能不会显示在窗口中。因此,使用renderdoc API来捕获xrBeginFrame和xrEndFrame之间的应用程序帧。

这允许renderdoc捕获应用程序框架,而不需要修改应用程序。

https://gitlab.freedesktop.org/monado/monado/-/commit/c162ff655b3b076fa15d21b9532f7864cb74161c

oxr_xrBeginFrame() {
rdoc_api->StartFrameCapture(NULL, NULL);
}
oxr_xrEndFrame() {
rdoc_api->EndFrameCapture(NULL, NULL);
}

PerCetto

Monado has two tracing backends, one based on PerCetto and the other based on Tracy.

https://github.com/olvaffe/percetto

PerCetto is a minimal C wrapper for Perfetto SDK to enable app-specific tracing.

https://github.com/olvaffe/percetto/blob/main/examples/timestamps.c

// u_trace_marker.c/.h
PERCETTO_INIT()
#define MY_PERCETTO_CATEGORIES(C, G) \
C(gfx, "Graphics events")
PERCETTO_CATEGORY_DEFINE(MY_PERCETTO_CATEGORIES);
PERCETTO_TRACK_DEFINE(gpu, PERCETTO_TRACK_EVENTS);
PERCETTO_TRACK_DEFINE(gpu_freq, PERCETTO_TRACK_COUNTER);
PERCETTO_TRACK_DEFINE(present, PERCETTO_TRACK_EVENTS);

Tracy

https://gitlab.freedesktop.org/monado/monado/-/blob/main/doc/tracing-tracy.md

https://github.com/wolfpld/tracy



Perfetto

https://perfetto.dev/ System profiling, app tracing and trace analysis

https://perfetto.dev/docs/tracing-101

Tracing和Profiling是两种用于性能分析的广泛使用的技术。Perfetto是一套开源工具,结合了tracing和profiling,为用户提供了对其系统的强大洞察。

Tracing

跟踪包括收集关于系统执行的非常详细的数据。

跟踪包含足够的细节来完全重建事件的时间轴。它们通常包括低级内核事件,如调度器上下文切换、线程唤醒、系统调用等。有了“正确的”跟踪,就不需要重现性能错误,因为跟踪提供了所有必要的上下文。

@u_pacing_compositor.c -> do_tracing()

Metrics

指标是高级概念,跟踪系统在一段时间内的性能,如CPU、内存使用率,网络带宽等,在程序运行时直接从应用程序或操作系统收集。

指标可以从trace数据分析得到,但对于线上环境,使用trace数据过于庞大(MB),一般直接进行指标分析(字节级)

Loging vs tracing

日志用于功能测试;Tracing用于性能分析。

Tracing是结构化的日志,以结构化的方式反映系统的详细状态,以允许重建事件的时间轴。

Profiling

对资源使用进行抽样,统计分析(如50ms),包括memory profiling和cpu profiling。

Profiling vs Tracing

Trace不可能捕获极端高频事件的执行,例如每个函数调用。Profiling工具填补了这一生态位:通过抽样,它们可以显著减少存储的信息量。Profiler的统计性质很少是一个问题; Profiler的采样算法是专门为捕获高度代表实际资源使用情况的数据而设计的。

Tracing提供确切的上下文信息。

Perfetto vs Tracy

Tracy 支持Linux和windows,实时查看数据流,只能同时跟踪一个应用程序

Perfetto 支持Linux和安卓,同时执行多个进程和整个系统跟踪

Monado其它性能分析工具(待研究)

Compositor

FPS (Compositor)

Frame Times

u_var_add_root(c, "Compositor", true);
u_var_add_ro_f32(c, &c->compositor_frame_times.fps, "FPS (Compositor)");
u_var_add_bool(c, &c->debug.atw_off, "Debug: ATW OFF");
u_var_add_f32_timing(c, c->compositor_frame_times.debug_var, "Frame Times (Compositor)");

Readback

u_var_add_ro_ftext(&t, "\n%s", "Record to CSV files");

Make OXR_DEBUG_GUI work with monado-service.

https://gitlab.freedesktop.org/monado/monado/-/merge_requests/622/diffs?commit_id=30d7001df1532e0b739f8ffaa4520417114630af

/src/xrt/state_trackers/gui/

imgui

src/external/imgui/imgui_monado.cpp

PlotTimings

igPlotTimings

_draw_line

_draw_grid

vars 变量跟踪

/src/xrt/auxiliary/util/u_var.h

/*!
* Global variable tracking state.
*/
static class Tracker gTracker;


u_var_add_root(c, "Compositor", true);
u_var_add_ro_f32(c, &c->compositor_frame_times.fps, "FPS (Compositor)");
u_var_add_bool(c, &c->debug.atw_off, "Debug: ATW OFF");
u_var_remove_root()

Android GPU Inspector

https://github.com/google/agi

https://gpuinspector.dev/

Oculus OVR Metrics Tool

RenderDoc

Metrics Tool

Logcat VrApi日志

Snapdragon Profiler

ovrgpuprofiler

OVR Metrics Tool参数和对应的VrApi日志值

https://news.nweon.com/68288

Monitor Performance with OVR Metrics Tool

https://alexdai.notion.site/alexdai/Monitor-Performance-with-OVR-Metrics-Tool-ef69774b6c2d4e3a80610b4c67505680

OVR Metrics Tool Usage

adb shell am start omms://app

Report Mode

adb shell setprop debug.oculus.omms.enableOverlay true

Basic

includes the following metrics:

    • FPS
    • CPU level
    • GPU level
    • Stale frame count
    • CPU utilization
    • GPU utilization
    • Available memory
    • App GPU time

Advanced

includes everything in Basic as well as the following metrics:

    • Extra latency mode
    • Foveation level
    • Prediction
    • Early frame count
    • Eye buffer width
    • Eye buffer height
    • Used memory
    • Asynchronous TimeWarp (ATW) GPU time

ovrgpuprofiler

These statistics include the following:

  • Guardian GPU Time
  • CPU Utilization Core 0-7
  • Application VSS, RSS, and Dalvik PSS

ovrgpuprofiler metrics

  • Average Vertices Per Frame
  • Average Fill Percentage per Eye
  • Average Instructions per Fragment
  • Average Instructions per Vertex
  • Average Textures per Fragment
  • Percentage Time Shading Fragments
  • Percentage Time Shading Vertices
  • Vertex Fetch Stall Percentage
  • Texture Fetch Stall Percentage
  • L1 Texture Miss Percentage
  • L2 Texture Miss Percentage
  • Texture Sample Percentage Using Nearest Filtering
  • Texture Sample Percentage Using Linear Filtering
  • Texture Sample Percentage Using Anisotropic Filtering

Performance HUD Mode

adb shell am broadcast -n com.oculus.ovrmonitormetricsservice/.SettingsBroadcastReceiver -a com.oculus.ovrmonitormetricsservice.ENABLE_OVERLAY



OVRMetricsTool_v1.6.0.apk

https://www.youtube.com/watch?v=OjRFr448JSE

OVR Metrics Tool可用于为在安卓设备上运行的Oculus应用程序提供性能指标,包括帧率,热量,GPU和CPU限制值,以及每秒的撕裂和过时帧数,OVR指标工具还提供远程设备管理功能。

报告模式:在VR会话结束后显示有关性能报告,报告数据可以轻松导出为包含PNG图像的CSV。

HUD模式:提供实时性能图表和信息叠加在正在运行应用上,以Overlay形式展示。

Basic

Advanced

Advanced with memory

Advanced with gpu

Advanced with memory and gpu

Display Stats on Overlay

Display Graph on Overlay

Display Debug Data on Overlay

Display App Name on Overlay





Pico

Metrics Tool

https://developer-global.pico-interactive.com/sdk?deviceId=1&platformId=1&itemId=15

更新内容

v1.2.1 版本更新内容:更新时间:2022-10-09

Update:
- Delete option:App GPU Time、Timewarp GPU Time、Guardian GPU Time
- Added graphs for CPU temperature and GPU temperature

v1.2.0 版本更新内容:更新时间:2022-07-14

Update:
Optimize compatibility

v1.1.0 版本更新内容:更新时间:2022-07-07

New features:
GPU Temperature: Shows the temperature unit of the GPU in degrees Celsius.
GPU Level (GPU L): GPU level value, the higher the overhead, the default 0 is automatically adjusted.
CPU Level (CPU L): CPU level value, the higher the overhead, the default 0 is automatic adjustment.
Display Refresh Rate (DRR): Device screen refresh rate .
Battery Level (BAT): remaining charge (%).
Battery Temperature (B TEM): displays the battery temperature in degrees Celsius.
Power Current (POW C): Displays the power current of the device in milliamperes.

v1.0.0 版本更新内容:更新时间:2021-10-13

Features:
- Supported Basic Statistics (GPU Utilization ,CPU Utilization,Average FPS,Available Memory)
- Supported Advanced Feature Statistics

Performance metrics

https://developer-global.pico-interactive.com/document/unity/performance-target

实时监控工具

https://developer-cn.pico-interactive.com/document/native/metrics-tool

监控指标说明

基础指标

实时监控监控工具统计的基础指标如下:

指标名称说明GPU Utilization (GPU U)总 GPU 占用率。CPU Utilization (CPU U)CPU 利用率百分比。Average FPS (FPS)帧速率(单位:帧/每秒)。注:一个好的应用程序的帧速率应等于屏幕的刷新率。Available Memory (A MEM)Android 上报的 VR 系统可用内存(单位:MB)。注:在 Android 上,内存是以某种不透明的方式处理的,因此该值仅用于一般指导。例如,如果一个应用程序转到后台,新的前景应用程序和操作系统操作将占用大量内存,可能会导致应用程序崩溃。因此,可利用该指标来监视内存的分配速度是否比预期的快,或者是否没有按预期释放内存。

相关内容