[英]Profiling a JRUBY rails application outputs <unknown> elements
Environment: Linux Mint 32 bit, JRuby-1.6.5 [ i386 ], Rails 3.1.3. 环境:Linux Mint 32位,JRuby-1.6.5 [i386],Rails 3.1.3。
I am trying to profile my rails application deployed on JRuby 1.6.5 on WEBrick (in development mode). 我正在尝试在WEBrick(处于开发模式)中概要分析部署在JRuby 1.6.5上的rails应用程序。
My JRUBY_OPTS: "-Xlaunch.inproc=false --profile.flat" 我的JRUBY_OPTS:“-Xlaunch.inproc = false --profile.flat”
In one of my models, I introduced an explicit sleep(5) and ensured that this method is called as part of before_save hook while saving the model. 在我的一个模型中,我引入了一个显式的sleep(5)并确保在保存模型时将此方法作为before_save挂钩的一部分进行调用。 Pseudo code...
伪代码...
class Invoice < ActiveRecord::Base
<some properties here...>
before_save :delay
private
def delay
sleep(5)
end
end
The above code ensures that just before an instance of Invoice gets persisted, the method, delay is invoked automatically. 上面的代码确保在Invoice实例持久化之前,会自动调用delay方法。
Now, when I profile the code that creates this model instance (through an rspec unit test), I get the following output: 现在,当我分析创建此模型实例的代码(通过rspec单元测试)时,得到以下输出:
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 output, why do I see those two elements instead of Invoice.delay or something similar. 在上面的输出中,为什么我看到这两个元素而不是Invoice.delay或类似的东西。
In fact, when I start my rails server (WEBrick) with the same JRUBY_OPTS (mentioned above), all my application code frames show up as unknown elements in the profiler output ! 实际上,当我使用相同的JRUBY_OPTS(如上所述)启动Rails服务器(WEBrick)时,我所有的应用程序代码帧在事件探查器输出中都显示为未知元素!
Am I doing anything wrong ? 我做错什么了吗?
Looks like you max of the profile methods limit Set -Xprofile.max.methods JRUBY_OPTS
to a big number (default is 100000 and is never enough). 似乎您的最大概要文件方法将
Set -Xprofile.max.methods JRUBY_OPTS
限制为一个很大的数字(默认值为100000,这是远远不够的)。 Eg 例如
export JRUBY_OPTS="--profile.flat -Xprofile.max.methods=10000000"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.