Lua: Difference between revisions
No edit summary |
No edit summary |
||
| Line 27: | Line 27: | ||
In WoW Lua, each variable contains a taint value, a string that identifies the AddOn from where the variable originated. | In WoW Lua, each variable contains a taint value, a string that identifies the AddOn from where the variable originated. | ||
=== Profiling === | |||
Because each variable is taint-tagged by whichever AddOn generated it, WoW Lua is able to compute the memory usage of any particular AddOn. | |||
<code> | |||
void lua_gcupdatesizes(lua_State* L); | |||
lu_mem lua_gcgetsize(lua_State* L, const char* tag); | |||
</code> | |||
Optionally, function performance can be profiled by turning on a flag. You can read the results of the function profiler with: | |||
<code> | |||
void lua_gcupdatetimes(lua_State* L); | |||
lua_Number lua_gcgettime(lua_State* L, const char* tag); | |||
void lua_gcgetfunctiontime(lua_State* L, lua_Number* flat, lua_Number* total, int32_t* ncalls); | |||
void lua_gcresettimes(lua_State* L); | |||
</code> | |||
=== Standard library === | === Standard library === | ||