Skip to content

Instantly share code, notes, and snippets.

@arielvalentin arielvalentin/
Last active Dec 21, 2015

What would you like to do?
Enable profiling for jruby apps deployed to torquebox
require 'rubygems'
require 'rack'
require 'jruby/profiler'
app = lambda {|env|
profile_data = JRuby::Profiler::profile do
output = (0..50).map do |i|
50 * i
puts output
my_output_stream =
print_stream =
profile_printer =
result = [my_output_stream.toString]
[200, { 'Content-Type' => 'text/plain' }, result]
run app
JRUBY_OPTS='--profile.api' torquebox run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.