bugfix: profile queue accept

This commit is contained in:
Cloud Wu
2014-04-22 19:38:20 +08:00
parent 960bd23c56
commit 277bc79fb7
2 changed files with 6 additions and 2 deletions

View File

@@ -93,7 +93,8 @@ lresume(lua_State *L) {
} else { } else {
lua_pop(L,1); lua_pop(L,1);
lua_pushvalue(L,1); lua_pushvalue(L,1);
lua_pushnumber(L, get_time()); double ti = get_time();
lua_pushnumber(L, ti);
lua_rawset(L, lua_upvalueindex(1)); // set start time lua_rawset(L, lua_upvalueindex(1)); // set start time
} }
@@ -121,7 +122,7 @@ lyield(lua_State *L) {
lua_pushthread(L); lua_pushthread(L);
lua_pushnumber(L, ti); lua_pushnumber(L, ti);
lua_rawset(L, lua_upvalueindex(1)); lua_rawset(L, lua_upvalueindex(2));
} }
lua_CFunction co_yield = lua_tocfunction(L, lua_upvalueindex(3)); lua_CFunction co_yield = lua_tocfunction(L, lua_upvalueindex(3));

View File

@@ -40,7 +40,10 @@ local function message_dispatch()
if f then if f then
if method[2] == "accept" then if method[2] == "accept" then
-- no return -- no return
profile.start()
local ok, data = pcall(f, table.unpack(msg)) local ok, data = pcall(f, table.unpack(msg))
local ti = profile.stop()
update_stat(method[3], ti)
if not ok then if not ok then
print(string.format("Error on [:%x] to [:%x] %s", msg.source, skynet.self(), tostring(data))) print(string.format("Error on [:%x] to [:%x] %s", msg.source, skynet.self(), tostring(data)))
end end