1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 03:49:52 +03:00

Lua memory (de)allocation tracer: (#5191)

* Lua memory (de)allocation tracer:

Usage:
 * turn on: `cmake -DLUA=YES -DLUA_ALLOCATOR_TRACER=YES -DDEBUG=YES -DNANO=NO`
 * get debug output and make plot data: `./simu 2>&1 | grep "^LT" | ../radio/util/lua_trace2plot.py > data.plot`
 * plot: `gnuplot  -e 'set xtics rotate;  plot "data.plot" using 2:xtic(1) ; pause mouse close'`

* Changes based on Bertrand comments
This commit is contained in:
Damjan Adamic 2017-11-11 09:41:05 +01:00 committed by Bertrand Songis
parent c30ff28f85
commit f0f3e35bf6
6 changed files with 161 additions and 8 deletions

View file

@ -168,10 +168,24 @@ void luaRegisterLibraries(lua_State * L);
void registerBitmapClass(lua_State * L);
void luaSetInstructionsLimit(lua_State* L, int count);
int luaLoadScriptFileToState(lua_State * L, const char * filename, const char * mode);
struct LuaMemTracer {
const char * script;
int lineno;
uint32_t alloc;
uint32_t free;
};
void * tracer_alloc(void * ud, void * ptr, size_t osize, size_t nsize);
void luaHook(lua_State * L, lua_Debug *ar);
#else // defined(LUA)
#define luaInit()
#define LUA_INIT_THEMES_AND_WIDGETS()
#define LUA_LOAD_MODEL_SCRIPTS()
#endif // defined(LUA)
#endif // _LUA_API_H_