A Lua module for tracing script execution, profiling performance, and analyzing code coverage with nanosecond-resolution timers.
luatrace is a Lua module for tracing script execution, profiling performance, and analyzing code coverage. It collects detailed timing and execution data by leveraging Lua's debug hooks, allowing developers to identify bottlenecks and understand code behavior. The tool supports high-resolution timers and works with both standard Lua and LuaJIT.
Lua developers and engineers who need to profile performance, analyze code coverage, or debug complex execution flows in their Lua scripts or applications.
Developers choose luatrace for its line-level tracing granularity, support for coroutines and error handling, and high-resolution timing across multiple platforms, providing deeper insights than basic profilers.
A tool for tracing Lua script execution and analysing time profiles and coverage
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Traces every line executed, not just function calls, enabling detailed profiling and coverage analysis that basic profilers miss.
Uses platform-specific timers like mach_absolute_time on macOS and clock_gettime on Linux for nanosecond-level measurements, improving accuracy.
Effectively traces through coroutine resumes/yields and error handling with pcall/xpcall, making it useful for complex Lua codebases.
Works with LuaJIT (with -joff) and provides -jannotate to analyze JIT trace attempts and aborts, aiding in optimization efforts.
The README explicitly states 'It's _really_ slow,' with timing inaccuracies due to debug hook overhead, making it unsuitable for live systems.
Requires disabling JIT compilation with -joff to function properly, which negates LuaJIT's performance benefits and complicates setup.
Only includes trace file and profiling backends, and the README admits 'there aren't many backends,' restricting analysis flexibility.
Involves manual instrumentation with tron/troff or command-line flags, and profiling is complicated for one-line functions, as noted in the Issues section.