add debug console command : ping

This commit is contained in:
Cloud Wu
2016-05-13 09:46:44 +08:00
parent 5be836527c
commit 1cf976c4e4
2 changed files with 18 additions and 1 deletions

View File

@@ -115,7 +115,7 @@ function COMMAND.help()
help = "This help message",
list = "List all the service",
stat = "Dump all stats",
info = "Info address : get service infomation",
info = "info address : get service infomation",
exit = "exit address : kill a lua service",
kill = "kill address : kill service",
mem = "mem : show memory status",
@@ -133,6 +133,7 @@ function COMMAND.help()
signal = "signal address sig",
cmem = "Show C memory info",
shrtbl = "Show shared short string table info",
ping = "ping address",
}
end
@@ -283,3 +284,11 @@ function COMMAND.shrtbl()
local n, total, longest, space = memory.ssinfo()
return { n = n, total = total, longest = longest, space = space }
end
function COMMAND.ping(fd, address)
address = adjust_address(address)
local ti = skynet.now()
skynet.call(address, "debug", "PING")
ti = skynet.now() - ti
return tostring(ti)
end