[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: [ANN] Luatrace - A Lua tracer and profiler
- From: Geoff Leyland <geoff_leyland@...>
- Date: Fri, 8 Apr 2011 18:14:09 +1200
Luatrace  is yet another tracer and profiler for Lua. It's now at the point where it seems to trace both Lua and LuaJIT (only with the compiler turned off with -joff) well enough that I can't see anything wrong. I'd welcome feedback (patches, forks...) from tests on your code.
Output from the profiler is a list of the 20 most time-consuming lines and an annotated source file with total, self and child times for each line executed. Luatrace separates the tracing from the profile analysis, and as such, it would be pretty easy to improve the profile report or add a coverage report (like LuaCov) or a call graph.
Unlike the other profilers I found, Luatrace traces every line executed so you get a more interesting trace, with the caveat that it's very slow.
As far as I can tell, the tracer it correctly follows resumes, yields, pcalls, xpcalls, errors, tail calls and recursion (getting that right on both Lua and LuaJIT was challenging).
Likewise, as far as I can tell, profile analyser correctly accumulates child times for recursive functions including a range of one-liners designed to give it (and me) a headache.
On OS X it uses the system's high-resolution nanosecond timer. I'd appreciate any help on using and testing high-res timers on other platforms.