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

Function ProfilerScopeBegin

engine/profiler/src/profiler.cpp:758–775  ·  view source on GitHub ↗

start a profile scope * * Starts a profile scope. * @note Must be correctly matched with a corresponding call to `profiler.scope_end()` in the same frame. * Any scopes left open at the end of the frame are reported as errors and auto-closed. * * @name profiler.scope_begin * @param name [type:string] The name of the scope * * @examples * ```lua * -- Go back one frame * profiler.scope_be

Source from the content-addressed store, hash-verified

756 * ```
757 */
758static int ProfilerScopeBegin(lua_State* L)
759{
760 DM_LUA_STACK_CHECK(L, 0);
761
762 size_t len;
763 const char* name = luaL_checklstring(L, 1, &len);
764 if (!name)
765 {
766 return DM_LUA_ERROR("Expected string as second argument");
767 }
768 if (!len)
769 {
770 return DM_LUA_ERROR("Expected non-empty string");
771 }
772
773 PushLuaProfilerScope(L, name, len);
774 return 0;
775}
776
777/*# end the current profile scope
778 *

Callers

nothing calls this directly

Calls 2

luaL_checklstringFunction · 0.85
PushLuaProfilerScopeFunction · 0.85

Tested by

no test coverage detected