到目前为止,我找到的最好的匹配方法是从命令行使用ruby-prof,并尝试从那里猜测图形读数。
require 'ruby-prof'
# Profile the code
RubyProf.start
...
[code to profile]
...
result = RubyProf.stop
# Print a flat profile to text
printer = RubyProf::FlatPrinter.new(result)
printer.print(STDOUT)https://github.com/rdp/ruby-prof
这种方法的主要问题是,您必须修改代码才能看到分析,而且可读性不是很好。
我也尝试过一些IDE: RubyMine,Aptana和Netbeans,但没有人有一个合适的图形界面来配置代码。
有什么建议吗?
发布于 2012-01-24 20:11:04
试试ruby-prof命令行工具:http://ruby-prof.rubyforge.org/files/bin/ruby-prof.html
并使用类似于以下内容:
ruby-prof -p graph_html -f filename.html rubycode.rb发布于 2013-07-02 23:38:23
签出迷你分析器:http://railscasts.com/episodes/368-miniprofiler
文档可以在这里找到:https://github.com/SamSaffron/MiniProfiler/tree/master/Ruby
检查特殊参数:pp=flamegraph -它非常容易分析。对于ruby 2.0,它甚至可以在生产环境中工作!
https://stackoverflow.com/questions/8448705
复制相似问题