mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-21 21:05:56 +00:00
Log the process commit in crash reports and in the memory census
A driver that runs out of memory faults or throws std::bad_alloc instead of returning an error: #285's log shows bad_alloc inside amdvlk64.dll under gpl_link, and nothing in the report told that apart from a driver bug. The crash report now prints the process and system commit, as rt_fatal does for our own failed allocations; --probe-kernel checks the line. The census at frames 600 and 1800 logs the commit as a baseline and, per heap, VMA's blocks and allocations beside the driver's usage and budget, so a report shows whose memory grew. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
717e68f601
commit
6e9ca1ebfd
3 files changed
+25
-1
No files matched your search
@@ -756,7 +756,9 @@ static void test_crash_report(void) {
|
||||
const char *g = report_line(out, "*5ca1ab1e0c0de002", line, sizeof line);
|
||||
CHECK(g && strstr(g, "x19"), "crash report: no memory line for x19 (%s)", g ? g : "none");
|
||||
CHECK(strstr(out, "guest stack sp+0x00:"), "crash report: no guest stack words");
|
||||
printf("crash report: exit code %d, host registers, code bytes, memory at rbx and x19, guest stack %s\n", code,
|
||||
CHECK(report_line(out, " memory commit: this process ", line, sizeof line) && !strstr(line, "process -1 MB"),
|
||||
"crash report: no memory commit line");
|
||||
printf("crash report: exit code %d, host registers, code bytes, memory at rbx and x19, guest stack, commit %s\n", code,
|
||||
failures ? "checked with failures" : "present");
|
||||
}
|
||||
|
||||
|
||||
@@ -298,6 +298,11 @@ static void crash_handler(const PlatCrash *x) {
|
||||
rt_log_raw("\n", 1);
|
||||
if (x->cxx_type)
|
||||
rt_logf(" C++ type %s%s%s\n", x->cxx_type, x->cxx_what ? ", what(): " : "", x->cxx_what ? x->cxx_what : "");
|
||||
// A driver that runs out of memory faults or throws (std::bad_alloc) instead of returning an error: the commit
|
||||
// tells that apart from a driver bug, as rt_fatal's line does for our own failed allocations.
|
||||
double proc, used, limit;
|
||||
plat_commit_info(&proc, &used, &limit);
|
||||
rt_logf(" memory commit: this process %.0f MB, the system %.0f of %.0f MB\n", proc, used, limit);
|
||||
uintptr_t fstart = 0;
|
||||
uint64_t f = x->module ? 0 : lifted_function_at(rip, &fstart);
|
||||
if (f)
|
||||
|
||||
@@ -571,6 +571,23 @@ void vk_mem_census(uint64_t frame) {
|
||||
n_import_failures, (unsigned long long)count[POOL_PHYS], total[POOL_PHYS] / 1048576.0,
|
||||
(unsigned long long)count[POOL_VIRT], total[POOL_VIRT] / 1048576.0,
|
||||
(unsigned long long)__atomic_load_n(&n_cross_defer, __ATOMIC_RELAXED));
|
||||
// The baseline for the commit a crash report prints: a crash far above it points at growth during play.
|
||||
double proc, used, limit;
|
||||
plat_commit_info(&proc, &used, &limit);
|
||||
rt_log("mem: commit at frame %llu: this process %.0f MB, the system %.0f of %.0f MB", (unsigned long long)frame, proc,
|
||||
used, limit);
|
||||
// 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();
|
||||
if (vc && vc->vma) {
|
||||
VmaBudget vb[VK_MAX_MEMORY_HEAPS];
|
||||
vmaGetHeapBudgets(vc->vma, vb);
|
||||
for (uint32_t h = 0; h < vc->mem_props.memoryHeapCount && h < VK_MAX_MEMORY_HEAPS; h++)
|
||||
rt_log("mem: heap %u (flags %#x) at frame %llu: vma %u blocks %.0f MiB, %u allocations %.0f MiB; driver usage "
|
||||
"%.0f of %.0f MiB", h, vc->mem_props.memoryHeaps[h].flags, (unsigned long long)frame,
|
||||
vb[h].statistics.blockCount, vb[h].statistics.blockBytes / 1048576.0, vb[h].statistics.allocationCount,
|
||||
vb[h].statistics.allocationBytes / 1048576.0, vb[h].usage / 1048576.0, vb[h].budget / 1048576.0);
|
||||
}
|
||||
static const char *const kinds[] = {"", "import", "physical", "virtual"};
|
||||
for (int j = 0; j < ng; j++) {
|
||||
char f[160];
|
||||
|
||||
Reference in new issue
Block a user