stat: add mem stat for jemalloc (#1218)

1, add opts arg for mallctl,dumpinfo
2, collect jemalloc.mem info
3, add debug_console cmd: jmem

Co-authored-by: fx <fx@f.x>
This commit is contained in:
fanlix
2020-07-22 19:26:39 +08:00
committed by GitHub
parent 693176efc8
commit f2b1bd7319
4 changed files with 48 additions and 5 deletions

View File

@@ -156,6 +156,7 @@ function COMMAND.help()
debug = "debug address : debug a lua service",
signal = "signal address sig",
cmem = "Show C memory info",
jmem = "Show jemalloc mem stats",
ping = "ping address",
call = "call address ...",
trace = "trace address [proto] [on|off]",
@@ -342,6 +343,15 @@ function COMMAND.cmem()
return tmp
end
function COMMAND.jmem()
local info = memory.jestat()
local tmp = {}
for k,v in pairs(info) do
tmp[k] = string.format("%11d %8.2f Mb", v, v/1048576)
end
return tmp
end
function COMMAND.ping(address)
address = adjust_address(address)
local ti = skynet.now()