snlua stat

This commit is contained in:
云风
2012-09-14 15:20:18 +08:00
parent 6fef0a871d
commit 564efd1b8b
4 changed files with 63 additions and 6 deletions

View File

@@ -13,6 +13,19 @@ function command.LIST()
skynet.ret(skynet.pack(list))
end
function command.STAT()
local list = {}
for k,v in pairs(services) do
local stat = skynet.call(k,"debug","STAT")
local result = {}
for k,v in pairs(stat) do
table.insert(result, string.format("%s = %s", k, tostring(v)))
end
list[skynet.address(k)] = table.concat(result,",") .. " (" .. v .. ")"
end
skynet.ret(skynet.pack(list))
end
function command.KILL(handle)
skynet.kill(handle)
skynet.ret( skynet.pack({ [handle] = tostring(services[handle]) }))