0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-04-29 13:04:17 +02:00

modules/console: Add option for short mem info only; use stack buffers.

This commit is contained in:
Jason Volk 2020-05-25 00:52:57 -07:00
parent acd0b71ccc
commit 5d60e6b2d4

View file

@ -1045,14 +1045,18 @@ console_cmd__mem(opt &out, const string_view &line)
ircd::allocator::profile::this_thread
};
char pbuf[2][48];
if(this_thread.alloc_count)
out << "IRCd thread allocations:" << std::endl
<< "alloc count: " << this_thread.alloc_count << std::endl
<< "freed count: " << this_thread.free_count << std::endl
<< "alloc bytes: " << pretty(iec(this_thread.alloc_bytes)) << std::endl
<< "freed bytes: " << pretty(iec(this_thread.free_bytes)) << std::endl
<< "alloc bytes: " << pretty(pbuf[0], iec(this_thread.alloc_bytes)) << std::endl
<< "freed bytes: " << pretty(pbuf[1], iec(this_thread.free_bytes)) << std::endl
<< std::endl;
if(opts == "ircd")
return true;
thread_local char buf[48_KiB];
out << "Allocator information:" << std::endl
<< allocator::info(buf, opts) << std::endl