AP_Scripting: add debug print of state memory cost

This commit is contained in:
Iampete1 2022-10-31 00:18:16 +00:00 committed by Peter Barker
parent 815adbbc8e
commit 7e07859ec9

View File

@ -462,9 +462,19 @@ void lua_scripts::run(void) {
gcs().send_text(MAV_SEVERITY_CRITICAL, "Lua: Couldn't allocate a lua state");
return;
}
#ifndef HAL_CONSOLE_DISABLED
const int inital_mem = lua_gc(L, LUA_GCCOUNT, 0) * 1024 + lua_gc(L, LUA_GCCOUNTB, 0);
#endif
lua_atpanic(L, atpanic);
load_generated_bindings(L);
#ifndef HAL_CONSOLE_DISABLED
const int loaded_mem = lua_gc(L, LUA_GCCOUNT, 0) * 1024 + lua_gc(L, LUA_GCCOUNTB, 0);
DEV_PRINTF("Lua: State memory usage: %i + %i\n", inital_mem, loaded_mem - inital_mem);
#endif
// Scan the filesystem in an appropriate manner and autostart scripts
// Skip those directores disabled with SCR_DIR_DISABLE param
uint16_t dir_disable = AP_Scripting::get_singleton()->get_disabled_dir();