diff --git a/lualib/snax.lua b/lualib/snax.lua index a84dbb46..c21272b2 100644 --- a/lualib/snax.lua +++ b/lualib/snax.lua @@ -166,4 +166,9 @@ function snax.printf(fmt, ...) skynet.error(string.format(fmt, ...)) end +function snax.profile_info(obj) + local t = snax.interface(obj.type) + return skynet_call(obj.handle, "snax", t.system.profile) +end + return snax diff --git a/lualib/snax/interface.lua b/lualib/snax/interface.lua index 740f09d9..df650865 100644 --- a/lualib/snax/interface.lua +++ b/lualib/snax/interface.lua @@ -35,7 +35,7 @@ return function (name , G, loader) local env = setmetatable({} , { __index = temp_global }) local func = {} - local system = { "init", "exit", "hotfix" } + local system = { "init", "exit", "hotfix", "profile"} do for k, v in ipairs(system) do diff --git a/service/snaxd.lua b/service/snaxd.lua index 1b8ddee6..4e2b7216 100644 --- a/service/snaxd.lua +++ b/service/snaxd.lua @@ -54,6 +54,8 @@ skynet.start(function() if command == "hotfix" then local hotfix = require "snax.hotfix" skynet.ret(skynet.pack(hotfix(func, ...))) + elseif command == "profile" then + skynet.ret(skynet.pack(profile_table)) elseif command == "init" then assert(not init, "Already init") local initfunc = method[4] or function() end