3 ms·
I didn't feel like getting into the nitty-gritty details of my analysis, but Ruby does have a profiler, and it integrates into Rails quite well, and I was using
by kscaldef 17y ago
I didn't feel like getting into the nitty-gritty details of my analysis, but Ruby does have a profiler, and it integrates into Rails quite well, and I was using it together with timers in this investigation. However, the exact same issue applies to the profiler as to simple timers, which is that the 150ms in question happens _after_ Rails hands off the reply to the web server, so as long as you are only measuring within the Rails framework, you will not see it.
- jasonkester 17y agoStrange. My expectation would be that you'd hook a profiler up to the web process and it would simply follow all ruby code paths, regardless of whether Rails were involved or not. Or do we have different definitions of Profiler? You're talking about a separate application that watches executing code and keeps statistics, right? As in, not simply a set of timing functions in a wrapper somewhere in the framework? If so, how does it come off the trolley after Rails finishes its job?
- kscaldef 17y agoruby-prof is a module that runs inside the ruby process, and hooks into the interpreter to track what's happening. You have options for how to run it. You can run the entire program within the profiler, but if you do that, you won't get data out until the process ends (you kill the webserver, in this case). Or, you can do what's more typical for profiling Rails, which is to explicitly activate the profiler for the course of a single request, and report on that single request.