From d635502c288441044c110afa81ef8a150a91e755 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 9 Jun 2019 21:26:47 +0000 Subject: [PATCH] Core: Improved memory profile git-svn-id: svn://ultimatepp.org/upp/trunk@13376 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/heaputil.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/uppsrc/Core/heaputil.cpp b/uppsrc/Core/heaputil.cpp index ebbf3121b..a2e3cd806 100644 --- a/uppsrc/Core/heaputil.cpp +++ b/uppsrc/Core/heaputil.cpp @@ -159,7 +159,7 @@ void Heap::Make(MemoryProfile& f) f.sys_total = sys_size; f.huge_count = int(big_count - sys_count); - f.huge_total = 4096 * max((int)big_size - (int)sys_size, 0); // this is not 100% correct, but approximate + f.huge_total = big_size - sys_size; // this is not 100% correct, but approximate f.master_chunks = (int)huge_chunks; @@ -210,6 +210,14 @@ String AsString(const MemoryProfile& mem) << ", total size " << (mem.large_fragments_total >> 10) << " KB\n"; text << "Huge block count " << mem.huge_count << ", total size " << int(mem.huge_total >> 10) << " KB\n"; + size_t hf = 0; + int cnt = 0; + for(int i = 0; i < 65535; i++) { + hf += 4 * mem.huge_fragments[i]; + cnt += !!mem.huge_fragments[i]; + } + text << "Huge fragments count " << cnt + << ", total size " << hf << " KB\n"; text << "Sys block count " << mem.sys_count << ", total size " << int(mem.sys_total >> 10) << " KB\n"; text << Heap::HPAGE * 4 / 1024 << "MB master blocks " << mem.master_chunks << "\n";