From: Andrew Grimm Date: 2011-10-11T08:06:53+09:00 Subject: [ruby-core:40094] Re: Statistical Profiling I'm not an expert on Ruby optimization, but have you looked at perftools.rb? It says that it's a sampling profiler with minimal overhead. https://github.com/tmm1/perftools.rb Andrew On Tue, Oct 11, 2011 at 3:29 AM, Roger Pack wrote: >> Would it be plausible to somehow, get the (ruby) stack of the running ruby process (or a particular thread), periodically? �For example, every 10 seconds. >> >> One approach might be to have a separate thread with a timer that popped and it would get the current stack for a particular thread (not itself). >> >> The overall objective is to have a very light weight (low impact) technique for profiling a Rails app as it is running in production. �Over the course of a week, for example, gather enough statistics to understand where the app is spending the most time. >> >> Of course, the other question is: has this already been done? �(I couldn't find anything.) > > I don't think it has. �1.9.x provides you a Thread#backtrace so it > should be possible just using that. �I've been meaning to incorporate > it into the > ruby-prof gem, and will put it on the backlog... > https://github.com/danielhoey/ruby-prof might already do it. > -r > >