lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> On Thu, 2004-05-06 at 15:44, Quinn Tyler Jackson wrote:
> > development. Are there any Lua profilers out there already?
>
> There are a couple.
>
> Check out the lua-users wiki on http://lua-users.org/wiki/
> particularly http://lua-users.org/wiki/ProfilingLuaCode
>
> D.

One can learn a lot about Lua internals and the Lua/C interface by writing a
profiler/debugger. As a current post from me shows, however, it didn't teach
me how to access table members from C code. ;-)

The profiler in TGF counts the time (in high resolution timer ticks) spent
in Lua calls, as well as in C/C++ calls invoked from Lua, and gives
"average" times spent in these functions based on the number of times these
functions are called. I've been thinking of adding line coverage statistics
as well, but don't know if that's really needed for what I'm using it for.

Probably the most time-consuming part to figure out was how to do a stack
dump that went from the current function up the stack to the top, when some
of the items on the stack are Lua variables, and others are wrapped C++
objects. That portion of the debugger still has quirks. I'd also like to add
breakpoints that fire on variable watches based on Lua expressions (eg.
"Break when functionname.variable == 10") but still haven't figured out how
that might be done.

But it's all fun.

--
Quinn