Getting profile information in Rails Console?


Rack::MiniProfiler has been working great for me in identifying performance problems. I’m wondering if there is a way to get profile information outside of the normal web request workflow. Is there any way to do something like the following in the rails console?

MiniProfiler.start("/tmp/profile_info.txt") do
  # expensive stuff here

I realize there are other profilers that do this well, but I already have this one in production.



Hi @cmatheson

Have you had any success with this?

I can produce an html file. Due to the way it links to the js/css files, I was getting XSS errors - so I currently need to put them into the public directory and serve it up.

It is very preliminary, as I needed to cut and paste a bunch of code. I’m seeing what I can do to reduce the duplicate code.

After that, I’ll see if it is possible to make a local file://profile.html work - but it is tricky since the library uses XHR which is not happy running from a local file.

Best of luck and let me know how you’re fairing with this