mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 16:49:58 -04:00
Log the sizes of the caches, pools and tables under the perf trace, every 600 presents and with each memory snapshot.
Four "mem: sizes" lines give the entries and bytes of what no other line counted: the guest heap, physical maps, kernel region, lazily written ranges and the fixed kernel, setjmp, save-file, RomFS and zstd tables; pool records, mirrors, deferred destructions, upload and staging buffers, the device address table and the texture, sampler and slot caches; image views, descriptor spares, the completion queue, uniform snapshot arenas, recording copies and pins; and pipelines, layouts, stage libraries, job queues, the shader memory cache and the translator processes. Each subsystem reads its own counters under its lock; settings now count the replaced values they keep. Segment and scene lines say "-" for the world clock before it starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6669,3 +6669,28 @@ int vk_pipeline_selftest(void) {
|
||||
printf("vk_pipeline selftest: %s\n", ok ? "passed" : "FAILED");
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
|
||||
// NX2NAVI_TRACE=perf "mem: sizes" (perf.c): the pipeline table's entries with their pipelines and fast links (never
|
||||
// evicted), layouts, stage libraries, the job queues and the pipeline-keys.bin set. A walk of the hash chains under P.lock
|
||||
// held shared: the workers' inserts and a draw's memo miss wait for it (well under a millisecond).
|
||||
void vk_pipeline_sizes(PerfSizes *s) {
|
||||
uint64_t ent = 0, built = 0, fast = 0, libn = 0, libb = 0, lq = 0;
|
||||
plat_mutex_lock_shared(&P.lock);
|
||||
for (int i = 0; i < PIPE_BUCKETS; i++)
|
||||
for (const Pipe *p = pipes[i]; p; p = p->next) ent++, built += p->info.pipeline != VK_NULL_HANDLE, fast += p->fast != VK_NULL_HANDLE;
|
||||
for (int i = 0; i < LIB_BUCKETS; i++)
|
||||
for (const Lib *b = libs[i]; b; b = b->next) libn++, libb += b->pipe != VK_NULL_HANDLE;
|
||||
for (const LibJob *j = U.head; j; j = j->next) lq++;
|
||||
uint64_t lay = P.stats.layouts, fails = P.stats.failures, jobs = A.inflight, seen = K.seen_n, seen_b = (uint64_t)K.seen_cap * 8;
|
||||
plat_mutex_unlock_shared(&P.lock);
|
||||
perf_size(s, "pipeline entries", ent, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "with a pipeline", built, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "fast links", fast, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "pipeline failures", fails, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "pipeline layouts", lay, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "stage library entries", libn, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "built stage libraries", libb, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "library jobs queued", lq, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "pipeline jobs queued or running", jobs, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "pipeline keys seen", seen, 0, seen_b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user