English 中文(简体)
铁路性能测试中 红宝石- prof 错误
原标题:Errors with ruby-prof in a Rails Performance Test

我在创建铁路性能测试,如Rails Guidelines 中所述,我对红宝石有问题。

我使用Ruby 1.9.2-p0(尽管在p320上遇到同样的问题)和铁路3.1.0。

我有一个非常简单的控制器测试 相当于"http://guides.rubyonrails.org/properation_conduction.html#controller-example" rel="noreferr">这个例子

根据 rel=“noreferr'>指南,我需要安装红宝石-prof,然后才能使用性能测试。当然,如果没有测试,我会得到:

在 Gemfile 中指定 Ruby- prof 作为应用程序依赖性, 以运行基准 。

如果我遵守了信的指南指示, 我会把这个添加到我的Gemfiles上:

宝石红宝石-prof,:git gt;git://gitub.com/wycats/ruby-prof.gt

... 并从 wycats 仓库获取版本 0. 11 。 当我运行测试时, 我得到这个错误 :

/Users/craig/.rvm/gems/ruby-1.9.2-p0/bundler/gems/ruby-prof-ffae61a89553/lib/ruby-prof/abstract_printer.rb:44:in `inspect : undefined method `to_s  for #<Class:0x000001025a3f18> (NoMethodError)
from /Users/craig/.rvm/gems/ruby-1.9.2-p0/bundler/gems/ruby-prof-ffae61a89553/lib/ruby-prof/abstract_printer.rb:44:in `full_name 
...

但“ wycats” 似乎不是红宝石的金字塔。 文档指的是 < a href=" https://github.com/rdp/ruby- prof" rel = “ noreferrer” >rdp (Roger Pack)。 如果我使用该 Repo 来代替 :

宝石红宝石-prof, : git gt; git://gitub.com/rdp/ruby-prof.gt

...我得到0.11.2版本, 并获得这个错误:

/Users/craig/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.1.0/lib/active_support/testing/performance/ruby.rb:39:in run : undefined methodvalues for [#]:Array (NoMethodError) from /Users/craig/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.1.0/lib/active_support/testing/performance.rb:140:in `run_profile ...

如果直接使用红宝石的宝石,我也会犯同样的错误(又用0.11.2版本):

宝石红宝石

任何想法什么是错的, 或如何解决这个问题?

最佳回答

要使用最新的红宝石药剂版本, 您需要铁路3. 2.3, 我不知道您可以用什么红宝石药剂版本使用铁路3.1, 或许您可以从活动支持3. 2.3 复制 lib/ active_ support/ suggest/ press/ ruby. rb 。

问题回答

问题在于主动支持3.2.2 libactive_supporting septing perfective uby.rb. 问题在于主动支持3.2.2 libactive_supporting septing production uby.rb.

第39行更改如下:

@total = @data.threads.sum(0) { |method_infos| method_infos.max.total_time }

致:

@total = @data.threads.sum(0) {|thread| thread.top_method.total_time}

Ruby on Rails 3.2.6 has this already corrected. https://github.com/rails/rails/blob/v3.2.6/activesupport/lib/active_support/testing/performance/ruby.rb

第39行

@total = @data.threads.sum(0) { |thread| thread.methods.max.total_time }

in Rails 3.2.3
https://github.com/rails/rails/blob/v3.2.3/activesupport/lib/active_support/testing/performance/ruby.rb

它们是:

@total = @data.threads.values.sum(0) { |method_infos| method_infos.max.total_time }

并且看起来“强”值 < / 强” 方法在此失败 。

我也有同样的问题,我为我的铁路版本安装了正确的红宝石药剂版本。

因此,我在使用2011年6月16日释放的铁路3.0.9(根据https://rubygems.org/gems/rails/versions )。

然后,我检查了大约同一天前后释放的红宝石丸。 2011年7月6日释放了0.10.8。

安装了以上设备后,我得到了它的工作原理,有些特征分析指标可能得不到支持。

欢呼声。

就我而言,铁路公司3.2.9, 我从我的项目中取消了自动生成的目录测试/性能。





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签