Add WiVRn-native Perfetto via Perfetto SDK

Optional server profiling built on the Perfetto SDK. Adds CPU spans
(compositor, encoder, network), GPU encode/copy slices from Vulkan timestamp
queries (Vulkan/NVENC/VAAPI), and headset feedback markers from dump_time.

WIVRN_TRACING enables tracing and selects the backend (system, inprocess, or
both); WIVRN_USE_PERFETTO gates it at build time and compiles it out otherwise.
WIVRN_TRACE_MONADO additionally drives Monado's percetto tracing from the same
switch so WiVRn and Monado land on one timeline.

Tooling: server-tracing[-monado] presets and a CI build, two Perfetto configs
(WiVRn-only and full-system), a wivrn_capture.py capture wrapper, a pftrace
summary script, and docs/profiling.md.
This commit is contained in:
Jonathan Steffan
2026-07-01 21:04:08 +02:00
committed by xytovl
parent b11655fdee
commit b9c8a54d92
34 changed files with 1968 additions and 58 deletions
+7 -40
View File
@@ -15,9 +15,7 @@ This guide covers debugging techniques for WiVRn, including log collection, cras
- [Crash Debugging](#crash-debugging)
- [Server Crashes](#server-crashes)
- [HMD Client Crashes](#hmd-client-crashes)
- [Performance Debugging](#performance-debugging)
- [Timing Analysis](#timing-analysis)
- [Perfetto Profiling](#perfetto-profiling)
- [Performance Profiling](#performance-profiling)
- [USB Tunneling](#usb-tunneling)
- [Game Debugging](#game-debugging)
- [Environment Variables Reference](#environment-variables-reference)
@@ -254,43 +252,12 @@ adb logcat '*:F' | grep -A 50 wivrn
---
## Performance Debugging
## Performance Profiling
### Timing Analysis
WiVRn can record detailed timing information for analysis.
Capture timing data:
```bash
WIVRN_DUMP_TIMINGS=/tmp/wivrn-timings.csv wivrn-server
```
### Perfetto Profiling
[Perfetto](https://perfetto.dev/) provides detailed system-wide profiling.
#### HMD Profiling
Enable persistent tracing on Android:
```bash
adb shell setprop persist.traced.enable 1
```
Open the [Perfetto UI](https://ui.perfetto.dev/), connect to your device, and configure tracing as needed.
See the [Android tracing quickstart](https://perfetto.dev/docs/quickstart/android-tracing) for detailed instructions.
#### Server Profiling
Ensure WiVRn is built with `XRT_FEATURE_TRACING=ON` to enable [Monado tracing with Perfetto](https://monado.pages.freedesktop.org/monado/tracing-perfetto.html).
Start with tracing enabled:
```bash
XRT_TRACING=true wivrn-server
```
WiVRn supports timing analysis via CSV dumps and detailed system-wide
profiling with Perfetto. See [docs/profiling.md](profiling.md) for capturing
timing data, profiling the HMD client and server, and comparing the Vulkan,
NVENC, and VAAPI encoder paths.
---
@@ -363,7 +330,7 @@ The log is located at `$XDG_STATE_HOME/xrizer/xrizer.txt`, or `$HOME/.local/stat
| `WIVRN_DUMP_TIMINGS` | Path to dump timing CSV (e.g., `/tmp/wivrn-timings.csv`) |
| `WIVRN_LOGLEVEL` | Log level for the native client |
| `WIVRN_AUTOCONNECT` | Auto-connect to the first discovered server |
| `XRT_TRACING` | Enable Perfetto tracing (`true`/`false`) |
| `WIVRN_TRACING` | Enable WiVRn Perfetto tracing: `system` / `inprocess`. Requires `WIVRN_USE_PERFETTO=ON` at build time. See [docs/profiling.md](profiling.md). |
### Vulkan