我可以使用什么来剖析1.9.2中的代码?所有ruby-prof的版本我都发现了1.9.2的segfault。如何在1.9.2中剖析Ruby代码?
举例来说,当我添加
gem "ruby-prof"
我Rails项目的Gemfile中,然后运行
bundle
bundle exec ruby-prof config/environment.rb
,我收到了段错误。
镇上有新的造型宝石吗?有没有办法让红宝石教练玩好?
我可以使用什么来剖析1.9.2中的代码?所有ruby-prof的版本我都发现了1.9.2的segfault。如何在1.9.2中剖析Ruby代码?
举例来说,当我添加
gem "ruby-prof"
我Rails项目的Gemfile中,然后运行
bundle
bundle exec ruby-prof config/environment.rb
,我收到了段错误。
镇上有新的造型宝石吗?有没有办法让红宝石教练玩好?
不知道它有帮助,但我偶然发现这可能会增加更多的清晰度或带领你走上不同的道路:http://www.devheads.net/development/ruby/core/segmentation-fault-when-using-ruby-prof-and-ruby-192.htm。你可能想检查出基于该线程的wycats的叉子:https://github.com/wycats/ruby-prof
另外,我还没有尝试过自己,它可能不是你正在寻找,但阿曼Github的声誉有一个谷歌端口, Ruby的perftools: https://github.com/tmm1/perftools.rb
作为@ chris.baglieri建议,您可以使用perftools.rb
gem来分析Ruby 1.9代码。
gem install perftools.rb
然后
require 'perftools'
PerfTools::CpuProfiler.start('profile_data') do
# something cpu-intensive
end
`pprof.rb --text profile_data profile.txt`
`pprof.rb --pdf profile_data profile.pdf`
您可以使用另一种流行的Profiler工具 - MethodProfiler
这是非常方便的找到目标类中缓慢方法。
当你没有'gem“ruby-prof”'但是运行包命令时它不会发生段错误? – 2011-03-08 22:10:14
那么,如果我在捆绑中没有'ruby-prof',那么我就不能'捆绑exec ruby-prof'。但是'bundle exec ruby config/environment.rb'不会segfault。 – Peeja 2011-03-09 03:44:32