JRABY rails application profiling displays <unknown> elements

Environment: Linux Mint 32 bit, JRuby-1.6.5 [i386], Rails 3.1.3.

I am trying to profile a rails application deployed on JRuby 1.6.5 on WEBrick (in development mode).

My JRUBY_OPTS: "-Xlaunch.inproc = false -profile.flat"

In one of my models, I introduced explicit sleep (5) and made sure that this method is called the hook before_save part when saving the model. Pseudo code ...

class Invoice < ActiveRecord::Base <some properties here...> before_save :delay private def delay sleep(5) end end 

The above code ensures that before the Invoice instance is saved, the delay method will be called automatically.

Now, when I look at the code that creates an instance of this model (via rspec unit test), I get the following output:

 6.31 0.00 6.31 14 RSpec::Core::ExampleGroup.run 6.30 0.00 6.30 14 RSpec::Core::ExampleGroup.run_examples 6.30 0.00 6.30 1 RSpec::Core::Example#run 6.30 0.00 6.30 1 RSpec::Core::Example#with_around_hooks 5.58 0.00 5.58 1 <unknown> 5.43 0.00 5.43 2 Rails::Application::RoutesReloader#reload! 5.00 0.00 5.00 1 <unknown> 5.00 5.00 0.00 1 Kernel#sleep 4.87 0.00 4.87 40 ActiveSupport.execute_hook 4.39 0.00 4.39 3 ActionDispatch::Routing::RouteSet#eval_block 4.38 0.00 4.38 2 Rails::Application::RoutesReloader#load_paths 

In the above example why I see these two elements instead of Invoice.delay or something like that.

In fact, when I start my rails server (WEBrick) with the same JRUBY_OPTS (mentioned above), all frames of the application code are displayed as unknown elements at the output of the profiler!

Am I doing something wrong?

+4
source share
1 answer

It seems that the maximum limit of Set -Xprofile.max.methods JRUBY_OPTS profile methods to a large number (by default, 100000 and never enough). For instance.

 export JRUBY_OPTS="--profile.flat -Xprofile.max.methods=10000000" 
+1
source

Source: https://habr.com/ru/post/1394961/


All Articles