2011-05-19 41 views
1

我嘗試使用紅寶石教授簡要介紹一下代碼。看來工作,直到下面的線表示:未定義的方法「主題」使用紅寶石教授

require 'rubygems' 
require 'ruby-prof' 
result = RubyProf.start do 
    puts "do stuff..." 
end 

printer = RubyProf::FlatPrinter.new(result) 
printer.print(STDOUT, {}) #fails here 

錯誤:

[email protected]:~/code/clancms$ ruby ./memtest.rb 
/home/hulkster/.rvm/gems/ruby-1.9.2-p180/gems/ruby-prof-0.10.7/lib/ruby-prof/flat_printer.rb:31:in `print_threads': undefined method `threads' for RubyProf:Module (NoMethodError) 
    from /home/hulkster/.rvm/gems/ruby-1.9.2-p180/gems/ruby-prof-0.10.7/lib/ruby-prof/flat_printer.rb:25:in `print' 
    from ./memtest.rb:8:in `<main>' 

有什麼建議?

回答

0

你確定它的意思是printer.print(STDOUT, {})而非printer.print(STDOUT, 0)

看看是否關閉垃圾收集幫助。請參閱下面的錯誤報告:https://github.com/rdp/ruby-prof/issues/80

而且,看是否紅寶石1.8下運行它(MRI)幫助。

如果你能生產出更具體的錯誤報告,那簡直也很有用。 :(

0

我得到這個錯誤。難道你是陰影結果變量/在你的代碼將其分配給別的東西以後?確保「結果」,你傳遞是真正的RubyProf結果對象。

相關問題