哪个是最好的图形化 Ruby 分析器?
到目前为止,我发现的最佳匹配是从命令行使用 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,但没有人拥有合适的图形界面来分析代码。
有什么推荐吗?
The best match that I have found until now is to use ruby-prof from command line and try to guess the graph reading from there.
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
The main problem with this approach is that you have to modify your code to see the profiling and is not very readable.
Also I have tried if some IDEs: RubyMine, Aptana and Netbeans and no one has a proper graphical interface to profile code.
Any recommendation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试 ruby-prof 命令行工具:
http://ruby-prof.rubyforge.org/files/bin/ruby -prof.html
并使用如下所示的内容:
Try the ruby-prof command line tool:
http://ruby-prof.rubyforge.org/files/bin/ruby-prof.html
And use something like following:
查看迷你分析器:http://railscasts.com/episodes/368-miniprofiler
文档可以在这里找到:https://github.com/SamSaffron/MiniProfiler/tree/master/Ruby
查看特殊参数:
pp=flamegraph
- 分析起来非常简单。对于 ruby 2.0,它甚至可以在生产环境中使用!Checkout mini-profiler: http://railscasts.com/episodes/368-miniprofiler
Documentation can be found here: https://github.com/SamSaffron/MiniProfiler/tree/master/Ruby
Checkout special parameter:
pp=flamegraph
- it's amazingly easy to profile. For ruby 2.0 it works even on production!