Class: RubyProf::Walker
- Inherits:
-
Object
- Object
- RubyProf::Walker
- Defined in:
- lib/ruby-prof/walker.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#min_fraction ⇒ Object
readonly
Returns the value of attribute min_fraction.
-
#roots ⇒ Object
readonly
Returns the value of attribute roots.
Instance Method Summary collapse
- #enter_frame(type, obj, name, called, elf_value, total_value) ⇒ Object
-
#initialize(roots, options = {}) ⇒ Walker
constructor
A new instance of Walker.
- #leave_frame(type, obj) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(roots, options = {}) ⇒ Walker
Returns a new instance of Walker.
6 7 8 9 10 11 12 13 |
# File 'lib/ruby-prof/walker.rb', line 6 def initialize(roots, ={}) @roots = roots @options = @all_time = @roots.map(&:total_time).inject(0.0, &:+) @min_percent = [:min_percent] || 2 @min_self_percent = [:min_self_percent] || 0.001 end |
Instance Attribute Details
#min_fraction ⇒ Object (readonly)
Returns the value of attribute min_fraction.
4 5 6 |
# File 'lib/ruby-prof/walker.rb', line 4 def min_fraction @min_fraction end |
#roots ⇒ Object (readonly)
Returns the value of attribute roots.
3 4 5 |
# File 'lib/ruby-prof/walker.rb', line 3 def roots @roots end |
Instance Method Details
#enter_frame(type, obj, name, called, elf_value, total_value) ⇒ Object
21 22 23 |
# File 'lib/ruby-prof/walker.rb', line 21 def enter_frame(type, obj, name, called, elf_value, total_value) raise NotImplementedError end |
#leave_frame(type, obj) ⇒ Object
25 26 27 |
# File 'lib/ruby-prof/walker.rb', line 25 def leave_frame(type, obj) raise NotImplementedError end |
#run ⇒ Object
15 16 17 18 19 |
# File 'lib/ruby-prof/walker.rb', line 15 def run around_frame(@roots, :all, "all", 1, 0.0, @all_time) do @roots.each { |r| visit(r) } end end |