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

Function EnableProfilerUI

engine/profiler/src/profiler.cpp:463–484  ·  view source on GitHub ↗

enables or disables the on-screen profiler ui * Creates and shows or hides and destroys the on-sceen profiler ui * * The profiler is a real-time tool that shows the numbers of milliseconds spent * in each scope per frame as well as counters. The profiler is very useful for * tracking down performance and resource problems. * * @name profiler.enable_ui * @param enabled [type:boolean] true t

Source from the content-addressed store, hash-verified

461 * ```
462 */
463static int EnableProfilerUI(lua_State* L)
464{
465 DM_LUA_STACK_CHECK(L, 0);
466
467 if (!lua_isboolean(L, 1))
468 {
469 return DM_LUA_ERROR("Invalid parameter, expected a boolean but got a %s", lua_typename(L, lua_type(L, 1)))
470 }
471
472 bool enabled = lua_toboolean(L, 1);
473
474 if (enabled && !gRenderProfile)
475 {
476 gRenderProfile = dmProfileRender::NewRenderProfile(gUpdateFrequency);
477 }
478 else if (!enabled)
479 {
480 DeleteProfilerUI();
481 }
482
483 return 0;
484}
485
486/*# sets the the on-screen profiler ui mode
487 * Set the on-screen profile mode - run, pause, record or show peak frame

Callers

nothing calls this directly

Calls 5

lua_typenameFunction · 0.85
lua_typeFunction · 0.85
lua_tobooleanFunction · 0.85
NewRenderProfileFunction · 0.85
DeleteProfilerUIFunction · 0.85

Tested by

no test coverage detected