To use this in your application your application should be running JRuby with the –profile.api switch turned on.
This is used like any other Rack middleware:
require 'rack_jruby_profiling' use Rack::JRubyProfiler
You can selectively turn on profiling on any request by adding “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.
There are two outputs supported by the built-in profiler at the moment. You can add “profile=<flat,graph>” to specify which you want to use. The default is “graph”. See danlucraft.com/blog/2011/03/built-in-profiler-in-jruby-1.6/ for more information on these outputs.
flat => plain text
graph => plain text
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.
Wanna run my tests? Cool. You'll need the following. They are all defined in the Gemfile, so if you are using Bundler, you can just
bundle check bundle install (if need be)
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, 2011 Jason Rogers. See LICENSE for details.