[英]Enable memory reports with rails-perftest (Rails 4.1.4, Ruby 2.1.2)
我使用rails 4.1.4,ruby 2.1.2和rvm。
Gemfile(提取)
gem 'rails-perftest'
gem 'ruby-prof', group: :test
我使用这些命令安装了ruby(为了应用启用内存分析的补丁)
rvm get stable
rvm reinstall 2.1.2 --patch railsexpress
但仍然没有运气和记忆报告是空的rake test:benchmark
或rake test:profile
我试图获得相同的Ruby补丁和版本使用Rails 3基准测试,虽然以不同的方式也被打破了。 在我看来,这是对Rails的疏忽。 我在Rails 3.2应用程序上看到这个警告字符串
$ bundle exec rake test:benchmark
Update your ruby interpreter to be able to run benchmarks.
$ bundle exec rails -v
Rails 3.2.21
问题似乎是ActiveSupport 3.2并不知道这个特定代码的Ruby版本高于2.0
if RUBY_VERSION.between?('1.9.2', '2.0')
require 'active_support/testing/performance/ruby/yarv'
elsif RUBY_VERSION.between?('1.8.6', '1.9')
require 'active_support/testing/performance/ruby/mri'
else
$stderr.puts 'Update your ruby interpreter to be able to run benchmarks.'
exit
end
手动编辑版本检查后,我可以确认该补丁在版本2.1.2的Rails 3中有效。 也许你可以检查你的RUBY_VERSION和RUBY_ENGINE常量是否有异常?
(我知道这不是一个真正的答案,但我没有足够的声誉来评论。还希望排除rvm补丁和ruby-prof作为问题)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.