Dan Eloff [dan.eloff@xxxxxxxxx] wrote: > I have a slightly fringe view of profiling. Usually all I want in a profiler > is a debugger > with a pause capability and the ability to inspect the stack of the paused > program. > ... > This answer on SO about what's wrong with gprof is somewhat enlightening: > http://stackoverflow.com/questions/1777556/alternatives-to-gprof/1779343#1779343 This is what led me to build the sampling profiler before working on my tracepoints prototype. The sampling profiler has worked well enough I haven't gone back to the tracepoints work yet. I occasionally wish I had something like it, but not often. The key change I had to make to Lua was to add a low overhead trigger hook so that having sampling enabled doesn't distort performance. Dan Eloff [dan.eloff@xxxxxxxxx] wrote: > I haven't found a good way to apply this technique to Lua. It's simple to > pause the > interpreter with gdb, but I can't make any sense ... > A Lua-based debugger resolves that, but doesn't let you pause inside C > frames... I've picked out the Lua stack frames in a native debugger, but it's a bit of a pain and you have to be careful since the VM state may not be entirely valid. I'd really like to do something along these lines: http://dtrace.org/blogs/brendan/2011/12/16/flame-graphs/ https://github.com/agentzh/nginx-systemtap-toolkit/blob/master/ngx-sample-lua-bt However, I don't know of a way to do it across the platforms I need to support (Mac and Windows and iOS). The dtrace techniques used for the above involves ustack helpers which I gather are broken on OS X. I haven't even dug into Windows yet. Dan Tull Adobe