Skip to content

Instantly share code, notes, and snippets.

@cue232s
Last active August 29, 2015 14:05
Show Gist options
  • Save cue232s/2cc4c2d1baa2439b7640 to your computer and use it in GitHub Desktop.
Save cue232s/2cc4c2d1baa2439b7640 to your computer and use it in GitHub Desktop.
Profiler not working, What am I doing wrong??
[22] pry(main)> profile_data = JRuby::Profiler.profile do
[22] pry(main)* [*50..1000].collect {|val| val = val + 10}
[22] pry(main)* end
=> #<Java::OrgJrubyRuntimeProfile::ProfileData:0x63d8669d>
[23] pry(main)> profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data)
=> #<Java::OrgJrubyRuntimeProfile::GraphProfilePrinter:0x18755efe>
[24] pry(main)> profile_printer.printProfile(STDOUT)
Total time: 0.00
%total %self total self children calls name
---------------------------------------------------------------------------------------------------------
100% 0% 0.00 0.00 0.00 1 (top)
0.00 0.00 0.00 1/1 Array#collect
0.00 0.00 0.00 1/1 Range#to_a
---------------------------------------------------------------------------------------------------------
0.00 0.00 0.00 1/1 (top)
94% 85% 0.00 0.00 0.00 1 Array#collect
0.00 0.00 0.00 951/951 Fixnum#+
---------------------------------------------------------------------------------------------------------
0.00 0.00 0.00 951/951 Array#collect
9% 9% 0.00 0.00 0.00 951 Fixnum#+
---------------------------------------------------------------------------------------------------------
0.00 0.00 0.00 1/1 (top)
5% 5% 0.00 0.00 0.00 1 Range#to_a
=> nil
[25] pry(main)>
Total time: 0.00
%total %self total self children calls name
---------------------------------------------------------------------------------------------------------
100% 100% 0.00 0.00 0.00 0 (top)
Started GET "/v1/some" for 127.0.0.1 at 2014-08-28 16:47:56 +0000
Processing by V1::SomeController#index as JSON
Parameters: {"some"=>{}}
Rendered text template (0.0ms)
Completed 200 OK in 18.0ms (Views: 15.0ms | ActiveRecord: 0.0ms)
equire 'jruby/profiler'
module V1
class SomeController < PublicController
def index
profile_data = JRuby::Profiler.profile do
[*50..1000].collect {|val| val = val + 10}
end
profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data)
gff = File.open('graph.txt.' + Time.now.to_s.delete(' '), 'w')
profile_printer.printProfile(gff)
render text: profile_printer.printProfile(STDOUT)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment