mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 04:19:57 -04:00
Hold a memory region thawed after a write thaws it soon after its freeze, so the game's streaming buffers stop going back and forth between frozen and thawed.
Regions the game has not written for a while are write-protected so that the per-submission write-watch queries can skip them, and the first write thaws them. The game's loaders keep writing the buffers they stream an area into, so those regions were frozen again as soon as they had been idle a moment and thawed again moments later: running from the Kakariko Village gate across Hyrule Field froze 31,004 regions and thawed 28,918 by a write in nine minutes. While the loaders wrote and the driver locked new memory, each thaw's VirtualQuery took 15 to 20 ms: a loader thread stalled 78 to 111 ms in thaws in every one of the hitches of 125 to 140 ms of that walk, with the game's main thread waiting for it. A write that thaws a region within a minute of its freeze now holds it thawed for 4 seconds, doubled at each such thaw up to 10 minutes; a region that stayed frozen longer starts again from nothing. On the same walk: 8,284 freezes and 6,355 thaws, no frame over 100 ms while Link ran where 29 and 52 a minute had been, the slowest 1 % of frames at 19 and 24 fps instead of 9 and 7, and at the walk's end, Link standing at the edge of Lake Hylia, 60 fps instead of 38 with the slowest 1 % at 43 instead of 20. The perf trace's write-watch line counts the holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3538,8 +3538,8 @@ static void mirror_log(uint64_t frame) {
|
||||
plat_mutex_unlock(&gen_lock);
|
||||
double wf = frame > ww_last ? (double)(frame - ww_last) : 1.0;
|
||||
ww_last = frame;
|
||||
uint64_t fz, ff, ft, fo;
|
||||
mem_freeze_stats(&fz, &ff, &ft, &fo);
|
||||
uint64_t fz, ff, ft, fo, fh;
|
||||
mem_freeze_stats(&fz, &ff, &ft, &fo, &fh);
|
||||
mem_probe_report(frame);
|
||||
mem_lazy_report(frame, lz_skipped);
|
||||
lz_skipped = 0;
|
||||
@@ -3558,9 +3558,10 @@ static void mirror_log(uint64_t frame) {
|
||||
if (rt_trace & RT_TRACE_PERF)
|
||||
rt_log("mem: write-watch frame %llu: per frame, every consumer: %.1f queries over %.1f MiB, %.3f ms (%.1f found "
|
||||
"%.0f written pages, %.3f ms); frozen %.0f MiB; since the last line: freezes %llu, thaws by a write %llu, by a file read "
|
||||
"or mapping change %llu, refused %llu",
|
||||
"or mapping change %llu, refused %llu; quick thaws that held a hot region thawed %llu",
|
||||
(unsigned long long)frame, wc / wf, wb / wf / 1048576.0, qpc_ms(wt) / wf, dc / wf, wp / wf, qpc_ms(dt) / wf,
|
||||
fz * 2.0, (unsigned long long)ff, (unsigned long long)ft, (unsigned long long)fo, (unsigned long long)nr);
|
||||
fz * 2.0, (unsigned long long)ff, (unsigned long long)ft, (unsigned long long)fo, (unsigned long long)nr,
|
||||
(unsigned long long)fh);
|
||||
if (!vk_mirror_on) return;
|
||||
plat_mutex_lock(&mirror_stat_lock);
|
||||
MirrorAcc a = macc;
|
||||
|
||||
Reference in New Issue
Block a user