feat: add an in-game performance panel (#1090)

Add in-game performance panel

Co-authored-by: nmzik <Nmzik@mail.ru>
This commit is contained in:
Juan Pablo Fariasandnmzik authored and GitHub committed 2026-10-17 14:47:51 +02:00
1 parent 415387f00d
commit 6aa3846fb2
35 files changed
+1788 -34

No files matched your search

+35
View File
@@ -4414,4 +4414,39 @@ int KYTY_SYSV_ABI KernelMemoryPoolGetBlockStats(KernelMemoryPoolBlockStats* outp
return OK;
}
DebugStats GetDebugStats() {
DebugStats stats;
stats.direct_total = PhysicalMemory::Size();
stats.flexible_total = FlexibleMemory::Size();
stats.pool_committed = g_memory_pool_committed.load(std::memory_order_relaxed);
stats.page_entries_total = PAGE_TABLE_POOL_ENTRIES;
if (g_physical_memory != nullptr) {
Common::LockGuard lock(g_physical_memory->GetMutex());
for (const auto& [start, block]: g_physical_memory->GetPhysicalBlocks()) {
switch (block.kind) {
case PhysicalMemory::AllocationKind::Direct:
stats.direct_allocated += block.size;
break;
case PhysicalMemory::AllocationKind::Pooled:
stats.pooled_allocated += block.size;
break;
case PhysicalMemory::AllocationKind::Automatic:
stats.automatic_allocated += block.size;
break;
}
}
for (const auto& mapping: g_physical_memory->GetMappings()) {
stats.direct_mapped += mapping.map_size;
}
}
if (g_flexible_memory != nullptr) {
stats.flexible_used = stats.flexible_total - g_flexible_memory->Available();
}
if (g_virtual_ranges != nullptr) {
stats.cpu_page_entries = g_virtual_ranges->CountPageTableEntries(false);
stats.gpu_page_entries = g_virtual_ranges->CountPageTableEntries(true);
}
return stats;
}
} // namespace Libs::LibKernel::Memory