Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions rts/Lua/LuaUnsyncedRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,23 +616,26 @@ int LuaUnsyncedRead::GetProfilerTimeRecord(lua_State* L)
{
const CTimeProfiler::TimeRecord& record = CTimeProfiler::GetInstance().GetTimeRecord(lua_tostring(L, 1));

int numRet = 5;
const bool wantFrameData = luaL_optboolean(L, 2, false);

lua_pushnumber(L, record.total.toMilliSecsf());
lua_pushnumber(L, record.current.toMilliSecsf());
lua_pushnumber(L, record.stats.x); // max-dt
lua_pushnumber(L, record.stats.y); // time-%
lua_pushnumber(L, record.stats.z); // peak-%

if (luaL_optboolean(L, 2, false)) {
for (size_t i = 0; i < record.frames.size(); i++) {
lua_pushnumber(L, i + 1); // key
lua_pushnumber(L, record.frames[i].toMilliSecsf()); // val
lua_rawset(L, -3);
}
++numRet;
if (!wantFrameData)
return 5;

lua_createtable(L, record.frames.size(), 0);

for (size_t i = 0; i < record.frames.size(); i++) {
lua_pushnumber(L, i + 1); // key
lua_pushnumber(L, record.frames[i].toMilliSecsf()); // val
lua_rawset(L, -3);
}

return numRet;
return 6;
}

/***
Expand Down
Loading