mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-27 16:02:37 +00:00
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:
1 parent
415387f00d
commit
6aa3846fb2
35 files changed
+1788
-34
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user