mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 04:19:57 -04:00
Add diagnostics used to find these fixes, all off by default.
NX2NAVI_TRACE=audio logs voices starting, stopping and sharing a wave buffer; NX2NAVI_DUMP_MOVIE dumps movie frames; NX2NAVI_LOG_CS_BINDS says why the stand-in for an untranslated compute program skipped a dispatch; and NX2NAVI_TRACE=perf adds heap and commit census lines on their own thread, with VMA maps when write-combined memory grows by 2 GiB. From a tester's fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -684,6 +684,26 @@ int plat_mem_state(uint64_t addr, uint64_t limit, uint64_t *end) {
|
||||
return p == PAGE_READWRITE ? PLAT_PROT_RW : p == PAGE_READONLY ? PLAT_PROT_READ : PLAT_PROT_NONE;
|
||||
}
|
||||
|
||||
int plat_mem_census(uint64_t *priv, uint64_t *wc, uint64_t *wc_allocs) {
|
||||
*priv = *wc = *wc_allocs = 0;
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
uintptr_t a = 0;
|
||||
void *last = NULL;
|
||||
while (VirtualQuery((void *)a, &mbi, sizeof mbi) == sizeof mbi) {
|
||||
if (mbi.State == MEM_COMMIT && mbi.Type == MEM_PRIVATE) {
|
||||
*priv += mbi.RegionSize;
|
||||
if (mbi.Protect & PAGE_WRITECOMBINE) {
|
||||
*wc += mbi.RegionSize;
|
||||
if (mbi.AllocationBase != last) (*wc_allocs)++, last = mbi.AllocationBase;
|
||||
}
|
||||
}
|
||||
uintptr_t next = (uintptr_t)mbi.BaseAddress + mbi.RegionSize;
|
||||
if (next <= a) break;
|
||||
a = next;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Contains code Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
|
||||
// GetWriteWatch with the reset flag.
|
||||
uint64_t plat_mem_written(uint64_t addr, uint64_t n, uint64_t *pages, uint64_t max, int reset) {
|
||||
|
||||
Reference in New Issue
Block a user