红宝石教授的负面时间?

时间:2013-01-17 17:23:05

标签: ruby-on-rails rspec ruby-prof

我正在使用基于ruby-prof的rspec-prof来描述需要相当长时间的规范。但是,我无法解释我得到的结果,因为它们报告的是负面时间。我是否正确使用rspec-prof / ruby​​-prof?这是一个错误吗?

zkhan@ubuntu:~/rails_projects/gamestory_app$ rspec spec/controllers/games_controller_spec.rb
Rack::File headers parameter replaces cache_control after Rack 1.5.
.#<RSpec::Core::Example:0xad11370>
Thread ID: 75909140
Total: -0.650803
Sort by: self_time

 %self      total      self      wait     child     calls  name
166.30     -6.402    -1.082     0.000    -5.320   212670   ActiveRecord::AttributeMethods::Dirty#write_attribute 
335.29     -0.278    -2.182     0.000     1.904   425424   ActiveRecord::AttributeMethods#column_for_attribute 
506.56      1.807    -3.297     0.000     5.103   170406   ActiveRecord::AttributeMethods#clone_attribute_value 
517.51     -1.086    -3.368     0.000     2.282    51106  *Hash#each 
580.84     -3.780    -3.780     0.000     0.000    79648   String#=~ 
597.22     -3.559    -3.887     0.000     0.327   114325   ActiveRecord::AttributeMethods#has_attribute? 
600.60     -3.909    -3.909     0.000     0.000   162452   Thread#[] 
601.95     -3.249    -3.917     0.000     0.669    46380   ActiveRecord::AttributeMethods#respond_to? 
607.83     -1.781    -3.956     0.000     2.175    76529  *Array#map 
627.42     -3.986    -4.083     0.000     0.097    93932   Fixnum#== 
629.84      1.281    -4.099     0.000     5.380    69849   <Class::ActiveRecord::Base>#connection 
641.72     -3.727    -4.176     0.000     0.449     8193   Logger::Formatter#call 
645.68     -3.893    -4.202     0.000     0.309    16428   <Class::Time>#time_with_datetime_fallback 
650.89     -4.229    -4.236     0.000     0.007     3486   <Class::Time>#_load_without_zone 
653.77     -4.223    -4.255     0.000     0.032     7122   ActiveSupport::TimeWithZone#respond_to? 
654.19     -4.116    -4.257     0.000     0.142     9510   EnumeratedAttribute::Attribute::AttributeDescriptor#allows_value? 
1236.59     -4.752    -8.048     0.000     3.296    58802   ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#quote 
2894.34    -18.465   -18.836     0.000     0.372    21840   BigDecimal#== 

* indicates recursively called methods
.

Finished in 2 minutes 24.62 seconds
2 examples, 0 failures

Randomized with seed 63912

1 个答案:

答案 0 :(得分:0)

这确实是ruby-prof中的一个错误。我把这个问题发布到了他们的GitHub网站,据说即将发布一个修复版本。

GitHub Issue Link