Skip to content

Instantly share code, notes, and snippets.

@arielvalentin arielvalentin/config.ru
Last active Dec 21, 2015

Embed
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
end
puts output
end
my_output_stream = java.io.ByteArrayOutputStream.new
print_stream = java.io.PrintStream.new(my_output_stream)
profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data)
profile_printer.printProfile(print_stream)
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.