mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 13:45:57 +00:00
heap_lazy adds the committed heap and the first-use faults with their total time to the commit census lines, so a log shows what the setting saved and cost
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a0587b59e7
commit
de0b1f899f
3 files changed
+17
No files matched your search
@@ -180,6 +180,9 @@ void mem_kernel_free(void *p, uint64_t size); // TLR/TLS reuse afte
|
||||
int mem_heap_lazy(void); // TOTK_HEAP_LAZY is on (Windows): heap pages commit on first use
|
||||
void mem_heap_commit(uint64_t a, uint64_t n); // commits the not yet committed heap chunks of [a, a+n) before
|
||||
// the kernel reads them; nothing when mem_heap_lazy is 0
|
||||
void mem_heap_lazy_stats(uint64_t *faults, uint64_t *ns, uint64_t *committed, uint64_t *size);
|
||||
// TOTK_HEAP_LAZY: first-use faults and their time since
|
||||
// the start, committed heap bytes, heap size
|
||||
uint64_t mem_heap_uncommitted(void); // heap bytes set by SetHeapSize but not committed yet
|
||||
// (TOTK_HEAP_LAZY): commit the game can still claim
|
||||
int mem_guest_readable(uint64_t a, uint64_t n); // [a, a+n) can be read without a fault: inside a loaded
|
||||
|
||||
@@ -286,6 +286,13 @@ int mem_heap_lazy(void) { return heap_lazy; }
|
||||
|
||||
void mem_heap_commit(uint64_t a, uint64_t n) { heap_commit_range(a, n); }
|
||||
|
||||
void mem_heap_lazy_stats(uint64_t *faults, uint64_t *ns, uint64_t *committed, uint64_t *size) {
|
||||
*faults = (uint64_t)__atomic_load_n(&lazy_faults, __ATOMIC_RELAXED);
|
||||
*ns = (uint64_t)__atomic_load_n(&lazy_ns, __ATOMIC_RELAXED);
|
||||
*committed = __atomic_load_n(&heap_committed, __ATOMIC_RELAXED);
|
||||
*size = __atomic_load_n(&heap_size, __ATOMIC_ACQUIRE);
|
||||
}
|
||||
|
||||
uint64_t mem_heap_uncommitted(void) {
|
||||
if (!heap_lazy) return 0;
|
||||
uint64_t size = __atomic_load_n(&heap_size, __ATOMIC_ACQUIRE), done = __atomic_load_n(&heap_committed, __ATOMIC_RELAXED);
|
||||
|
||||
@@ -585,6 +585,13 @@ void vk_mem_census(uint64_t frame) {
|
||||
rt_log("mem: commit at frame %llu: this process %.0f MB, the system %.0f of %.0f MB; room for device memory %s%.0f MiB",
|
||||
(unsigned long long)frame, proc, used, limit, room == UINT64_MAX ? "not counted " : "",
|
||||
room == UINT64_MAX ? 0.0 : room / 1048576.0);
|
||||
if (mem_heap_lazy()) { // what the heap's first-use commits (memory.c heap_fault) cost and saved so far
|
||||
uint64_t nf, ns, hc, hs;
|
||||
mem_heap_lazy_stats(&nf, &ns, &hc, &hs);
|
||||
rt_log("mem: heap at frame %llu: %llu of %llu MiB committed, %llu first-use faults, %.1f ms in all",
|
||||
(unsigned long long)frame, (unsigned long long)(hc >> 20), (unsigned long long)(hs >> 20),
|
||||
(unsigned long long)nf, ns / 1e6);
|
||||
}
|
||||
// Per heap, what VMA holds (blocks, and the allocations inside them) beside what the driver counts for the process:
|
||||
// usage above VMA's blocks is the driver's own memory (pipelines, command buffers, descriptor pools).
|
||||
VkCtx *vc = vk_ctx();
|
||||
|
||||
Reference in new issue
Block a user