2011-08-26 28 views
0

我想使用Ruby的標準lib分析器,並且我沒有使用ruby-prof,因爲這是一個jruby項目。如何在Jruby中使用Ruby stdlib分析器?

雖然,我百達得到的東西,如:

% cumulative self    self  total 
time seconds seconds calls ms/call ms/call name 
    0.00  0.93  0.00  1  0.00 930.00 #toplevel 

產生這是代碼:

require 'profiler' 
Profiler__.start_profile 
# profiling_result = RubyProf.profile do 
result= handle_request 

# end 
#Profiler__.stop_profile 

# printer = RubyProf::FlatPrinter.new(result) 
File.open("#{File.dirname(__FILE__)}/profiler/#{Time.now.to_i}.flat","w") do |f| 
    Profiler__.print_profile f 
end 
Profiler__.stop_profile 
+0

提示建議堆棧採樣,而不是5,4,3 ... –

+0

對不起,但我不明白你想通過你的評論傳達什麼。 –

回答