Is it possible to ignore irrelevant methods when profiling ruby applications?

后端 未结 2 1385
眼角桃花
眼角桃花 2021-01-22 19:24

While using ruby-prof, printed out in graph-html mode, the report for one method says (with some snipping)

%Total       %Self       Total       Self    Wait    C         


        
相关标签:
2条回答
  • 2021-01-22 19:54

    Version 0.9.0 of ruby-prof allows method elimination. For example, to eliminate Integer#times, use

    result = RubyProf.stop
    result.eliminate_methods!([/Integer#times/])
    

    so that

    def method_a
      5.times {method_b}
    end
    

    will indicate the relationship between method_a and method_b directly.

    0 讨论(0)
  • 2021-01-22 20:12

    If you don't mind low-tech, maybe you want to consider this. All you need is to be able to pause the debugger. Guaranteed, it will quickly find anything you can find any other way, and not show you any irrelevant code.

    0 讨论(0)
提交回复
热议问题