Path: | lib/ruby-prof/call_info_visitor.rb |
Last Update: | Wed Apr 17 16:20:07 +0000 2013 |
The call info visitor class does a depth-first traversal across a thread‘s call stack. At each call_info node, the visitor executes the block provided in the visit method. The block is passed two parameters, the event and the call_info instance. Event will be either :enter or :exit.
visitor = RubyProf::CallInfoVisitor.new(result.threads.first) method_names = Array.new visitor.visit do |call_info, event| method_names << call_info.target.full_name if event == :enter end puts method_names