rack_jruby_profiling

To use this in your application you need to have JRubyProf (github.com/danlucraft/jruby-prof) installed and available, and your application should be running on the JVM (of course).

This is used like any other Rack middleware:

require 'rack_jruby_profiling'
use Rack::JRubyProfiler

You can selectively turn off profiling on any request by adding “no_profile=<t,true,y,yes>” to the query parameter list.

The results of the profiling are streamed directly to your client. If you would like to download the file that is generated instead, add a “download=<t,true,y,yes>” parameter to your request.

JRubyProf supports 5 different profile outputs. You can add “profile=<flat,graph,call_tree,graph_html,tree_html>” to specify which you want to use. The default is “tree_html”. See danlucraft.com/blog/2010/03/jruby-prof/ for more information on these outputs.

  • flat => plain text

  • graph => plain text

  • call_tree => plain text

  • graph_html => HTML

  • tree_html => HTML

Caveat

JRubyProf generates files for the profiling information. These files are generated in the current working directory. This middleware doesn’t attempt to delete those files after they are generated. That’s an exercise left to the user.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Jason Rogers. See LICENSE for details.