Class: NewRelic::Agent::Threading::BacktraceRoot
Instance Attribute Summary collapse
#children
Instance Method Summary
collapse
#add_child, #add_child_unless_present, #find_child
Constructor Details
Returns a new instance of BacktraceRoot.
37
38
39
40
|
# File 'lib/new_relic/agent/threading/backtrace_node.rb', line 37
def initialize
super
@flattened = []
end
|
Instance Attribute Details
#flattened ⇒ Object
Returns the value of attribute flattened.
35
36
37
|
# File 'lib/new_relic/agent/threading/backtrace_node.rb', line 35
def flattened
@flattened
end
|
Instance Method Details
#==(other) ⇒ Object
42
43
44
|
# File 'lib/new_relic/agent/threading/backtrace_node.rb', line 42
def ==(other)
true end
|
#aggregate(backtrace) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/new_relic/agent/threading/backtrace_node.rb', line 50
def aggregate(backtrace)
current = self
depth = 0
backtrace.reverse_each do |frame|
break if depth >= MAX_THREAD_PROFILE_DEPTH
existing_node = current.find_child(frame)
if existing_node
node = existing_node
else
node = Threading::BacktraceNode.new(frame)
current.add_child(node)
@flattened << node
end
node.runnable_count += 1
current = node
depth += 1
end
end
|
#as_array ⇒ Object
46
47
48
|
# File 'lib/new_relic/agent/threading/backtrace_node.rb', line 46
def as_array
@children.map { |c| c.as_array }.compact
end
|
#dump_string ⇒ Object
72
73
74
75
76
77
|
# File 'lib/new_relic/agent/threading/backtrace_node.rb', line 72
def dump_string
result = +"#<BacktraceRoot:#{object_id}>"
child_results = @children.map { |c| c.dump_string(2) }.join("\n")
result << "\n" unless child_results.empty?
result << child_results
end
|