[PR #5] [MERGED] Measure resident process memory during game benchmarks #2252

Closed
opened 2026-11-02 15:54:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5
Author: @ludovic111
Created: 10/3/2026
Status: ✅ Merged
Merged: 10/3/2026
Merged by: @ludovic111

Base: main ← Head: process-memory-measurements


📝 Commits (2)

  • b9b1272 Measure resident process memory off game threads during benchmarks
  • 901aa7d Document game and cross-platform resident-memory validation

📊 Changes

16 files changed (+254 additions, -13 deletions)

View changed files

📝 README.md (+2 -2)
📝 docs/playable-validation.md (+16 -0)
➕ docs/process-memory.md (+44 -0)
📝 mods/horizon-lab/src/main/java/dev/horizonlab/HorizonLab.java (+3 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ProcessMemoryMonitor.java (+53 -0)
📝 mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Recording.java (+24 -1)
📝 mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Reports.java (+1 -1)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ResidentMemory.java (+20 -0)
📝 mods/horizon-lab/src/main/resources/fabric.mod.json (+1 -1)
📝 mods/horizon-lab/src/test/java/dev/horizonlab/metrics/MetricsTest.java (+14 -0)
➕ mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ResidentMemoryTest.java (+59 -0)
📝 packs/START-HERE.txt (+5 -1)
📝 packs/mods.lock.json (+1 -1)
📝 tools/Compare-Benchmarks.html (+4 -2)
📝 tools/build_mod.py (+5 -2)
📝 tools/compare_benchmarks.py (+2 -2)

📄 Description

Heap-only benchmarks can miss native memory costs. Record sampled resident process memory through Minecraft’s existing OSHI dependency and show RSS separately in the offline viewer and CLI.

One low-priority background reader serves overlapping frame and tick recordings. It initializes native dependencies off game threads, polls about once per second only while recordings are active, ignores late results, and omits unavailable measurements rather than reporting zero. Reports include peak, last sample, sample count and age. RSS is not a complete GPU/unified-memory accounting.

Validation: real native reads, overlapping recordings, idle cancellation and unavailable-reader checks pass on Linux, Windows and Apple Silicon macOS. The exact candidate JAR rendered the demo world, produced 370 frame / 2,407 server-tick samples over 120 seconds, and recorded 120 RSS samples in each report. Raw CSV counts/means match JSON, and post-recording thread inspection confirms idle polling cancellation. Chromium displays RSS and the real CSV successfully; existing viewer checks and all 19 Python tests pass. Game saves/quits cleanly. No FPS or RAM reduction is claimed by this instrumentation release.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/3/2026 **Status:** ✅ Merged **Merged:** 10/3/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `process-memory-measurements` --- ### 📝 Commits (2) - [`b9b1272`](https://github.com/horizon-rust/horizon/commit/b9b12724abe14e5391ae54ed0792a0a712382cff) Measure resident process memory off game threads during benchmarks - [`901aa7d`](https://github.com/horizon-rust/horizon/commit/901aa7d819daf66e61e4f1de8f17d87ccf4045e5) Document game and cross-platform resident-memory validation ### 📊 Changes **16 files changed** (+254 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+2 -2) 📝 `docs/playable-validation.md` (+16 -0) ➕ `docs/process-memory.md` (+44 -0) 📝 `mods/horizon-lab/src/main/java/dev/horizonlab/HorizonLab.java` (+3 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ProcessMemoryMonitor.java` (+53 -0) 📝 `mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Recording.java` (+24 -1) 📝 `mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Reports.java` (+1 -1) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ResidentMemory.java` (+20 -0) 📝 `mods/horizon-lab/src/main/resources/fabric.mod.json` (+1 -1) 📝 `mods/horizon-lab/src/test/java/dev/horizonlab/metrics/MetricsTest.java` (+14 -0) ➕ `mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ResidentMemoryTest.java` (+59 -0) 📝 `packs/START-HERE.txt` (+5 -1) 📝 `packs/mods.lock.json` (+1 -1) 📝 `tools/Compare-Benchmarks.html` (+4 -2) 📝 `tools/build_mod.py` (+5 -2) 📝 `tools/compare_benchmarks.py` (+2 -2) </details> ### 📄 Description Heap-only benchmarks can miss native memory costs. Record sampled resident process memory through Minecraft’s existing OSHI dependency and show RSS separately in the offline viewer and CLI. One low-priority background reader serves overlapping frame and tick recordings. It initializes native dependencies off game threads, polls about once per second only while recordings are active, ignores late results, and omits unavailable measurements rather than reporting zero. Reports include peak, last sample, sample count and age. RSS is not a complete GPU/unified-memory accounting. Validation: real native reads, overlapping recordings, idle cancellation and unavailable-reader checks pass on Linux, Windows and Apple Silicon macOS. The exact candidate JAR rendered the demo world, produced 370 frame / 2,407 server-tick samples over 120 seconds, and recorded 120 RSS samples in each report. Raw CSV counts/means match JSON, and post-recording thread inspection confirms idle polling cancellation. Chromium displays RSS and the real CSV successfully; existing viewer checks and all 19 Python tests pass. Game saves/quits cleanly. No FPS or RAM reduction is claimed by this instrumentation release. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:54:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2252
No description provided.