MCPcopy Create free account
hub / github.com/defold/defold / ProfilerScopeEnd

Function ProfilerScopeEnd

engine/profiler/src/profiler.cpp:784–802  ·  view source on GitHub ↗

end the current profile scope * * End the current profile scope. * @note Calling this without a matching `profiler.scope_begin()` raises a Lua error. * @name profiler.scope_end * */

Source from the content-addressed store, hash-verified

782 *
783 */
784static int ProfilerScopeEnd(lua_State* L)
785{
786 DM_LUA_STACK_CHECK(L, 0);
787 LuaProfilerScope scope = {0};
788 LuaProfilerScopeState* state = PopLuaProfilerScope(L, &scope);
789 if (state == 0)
790 {
791 return DM_LUA_ERROR("profiler.scope_end() called without a matching profiler.scope_begin()");
792 }
793
794 const char* name = GetLuaProfilerScopeName(state, &scope);
795 ProfileScopeEnd(name, scope.m_NameHash);
796 state->m_Names.SetSize(scope.m_NameOffset);
797 if (state->m_Scopes.Empty() && !state->m_IsMainThread)
798 {
799 DeleteLuaProfilerScopeState(state);
800 }
801 return 0;
802}
803
804
805/*# continously show latest frame

Callers

nothing calls this directly

Calls 6

PopLuaProfilerScopeFunction · 0.85
GetLuaProfilerScopeNameFunction · 0.85
ProfileScopeEndFunction · 0.50
SetSizeMethod · 0.45
EmptyMethod · 0.45

Tested by

no test coverage detected