mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
add debug console command : ping
This commit is contained in:
@@ -69,6 +69,14 @@ function dbgcmd.SUPPORT(pname)
|
|||||||
return skynet.ret(skynet.pack(skynet.dispatch(pname) ~= nil))
|
return skynet.ret(skynet.pack(skynet.dispatch(pname) ~= nil))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function dbgcmd.PING()
|
||||||
|
return skynet.ret()
|
||||||
|
end
|
||||||
|
|
||||||
|
function dbgcmd.LINK()
|
||||||
|
-- no return, raise error when exit
|
||||||
|
end
|
||||||
|
|
||||||
return dbgcmd
|
return dbgcmd
|
||||||
end -- function init_dbgcmd
|
end -- function init_dbgcmd
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ function COMMAND.help()
|
|||||||
help = "This help message",
|
help = "This help message",
|
||||||
list = "List all the service",
|
list = "List all the service",
|
||||||
stat = "Dump all stats",
|
stat = "Dump all stats",
|
||||||
info = "Info address : get service infomation",
|
info = "info address : get service infomation",
|
||||||
exit = "exit address : kill a lua service",
|
exit = "exit address : kill a lua service",
|
||||||
kill = "kill address : kill service",
|
kill = "kill address : kill service",
|
||||||
mem = "mem : show memory status",
|
mem = "mem : show memory status",
|
||||||
@@ -133,6 +133,7 @@ function COMMAND.help()
|
|||||||
signal = "signal address sig",
|
signal = "signal address sig",
|
||||||
cmem = "Show C memory info",
|
cmem = "Show C memory info",
|
||||||
shrtbl = "Show shared short string table info",
|
shrtbl = "Show shared short string table info",
|
||||||
|
ping = "ping address",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -283,3 +284,11 @@ function COMMAND.shrtbl()
|
|||||||
local n, total, longest, space = memory.ssinfo()
|
local n, total, longest, space = memory.ssinfo()
|
||||||
return { n = n, total = total, longest = longest, space = space }
|
return { n = n, total = total, longest = longest, space = space }
|
||||||
end
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user