perf Reference
Module defined in `lua/common/utils/perf.lua`. Performance profiler that tracks function execution times using debug hooks, with windowed statistics and CSV export.
Module defined in lua/common/utils/perf.lua. Performance profiler that tracks function execution times using debug hooks, with windowed statistics and CSV export.
Exports
Functions
M.enable(_windowSize, _guiHook, _srcData)
Enable performance profiling.
- Parameters:
_windowSize- number - Number of frames to average over_guiHook- string|nil - GUI hook name for display_srcData- table|nil - External data source
M.disable()
Disable performance profiling and remove debug hooks.
M.update()
Process accumulated profiling data for the current frame. Call each frame.
M.getData()
Get the current profiling statistics.
- Returns: table - Statistics data table
M.saveDataToCSV(filename)
Export profiling data to a CSV file.
- Parameters:
filename- string - Output CSV file path
Variables
M.data
- Type: table
- Description: Current frame statistics including
frameCount,size(window size),memory(Lua memory usage), and per-function timing data
Internal Notes
- Uses
debug.sethookwith "cr" (call/return) events for timing start(name)/stop(name)internal functions bracket timed sections_updatecomputes windowed averages each frame- Memory tracked via
gcinfo()
languageMap Reference
Module defined in `lua/common/utils/languageMap.lua`. Maps ISO language and country codes to human-readable names. Includes Weblate translation platform codes.
pixellib Reference
Module defined in `lua/common/utils/pixellib.lua`. Small pixel drawing library for rendering primitives and text to RGBA buffers, with file save support.