Class: Stackprofiler::Filter::RebaseStack

Inherits:
Object
  • Object
show all
Defined in:
lib/stackprofiler/filters/rebase_stack.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RebaseStack

Returns a new instance of RebaseStack.



6
7
8
# File 'lib/stackprofiler/filters/rebase_stack.rb', line 6

def initialize(options={})
  self.top_names = options[:name].presence || RebaseStack.default
end

Instance Attribute Details

#top_namesObject

Returns the value of attribute top_names.



4
5
6
# File 'lib/stackprofiler/filters/rebase_stack.rb', line 4

def top_names
  @top_names
end

Class Method Details

.defaultObject



19
20
21
# File 'lib/stackprofiler/filters/rebase_stack.rb', line 19

def default
  ['Stackprofiler::DataCollector#call', 'block in Stackprofiler#profile']
end

Instance Method Details

#filter(root, frames) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/stackprofiler/filters/rebase_stack.rb', line 10

def filter root, frames
  root.find do |node|
    addr = node.content[:addrs].first.to_i
    top_names.include? frames[addr][:name]
    # frames[addr][:name] == top_names
  end || root
end