Class: TraceViz::TraceData::SummaryNode
- Defined in:
- lib/trace_viz/trace_data/summary_node.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#representative_node ⇒ Object
readonly
Returns the value of attribute representative_node.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Attributes inherited from Node
Attributes included from TraceViz::Traits::TimeTrackable
Attributes included from TraceViz::Traits::DepthTrackable
Instance Method Summary collapse
- #duration ⇒ Object
-
#initialize(group:) ⇒ SummaryNode
constructor
A new instance of SummaryNode.
- #key ⇒ Object
- #total_duration ⇒ Object
Methods inherited from Node
#add_child, #add_children, #to_h
Methods inherited from Base
Methods included from TraceViz::Traits::TimeTrackable
Methods included from TraceViz::Traits::DepthTrackable
Methods included from Helpers::ConfigHelper
#config, #fetch_general_config
Constructor Details
#initialize(group:) ⇒ SummaryNode
Returns a new instance of SummaryNode.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 10 def initialize(group:) super() @group = group @count = group.size @representative_node = group.first @depth = representative_node.depth @event = representative_node.event @klass = representative_node.klass @path = representative_node.path @action = representative_node.action # Representative node is the first node in the group belonging to MethodCall @params = representative_node.params @result = representative_node.method_return.result add_children(representative_node.children) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
8 9 10 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 8 def action @action end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
8 9 10 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 8 def count @count end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
8 9 10 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 8 def event @event end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
8 9 10 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 8 def group @group end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
8 9 10 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 8 def klass @klass end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 8 def params @params end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 8 def path @path end |
#representative_node ⇒ Object (readonly)
Returns the value of attribute representative_node.
8 9 10 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 8 def representative_node @representative_node end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 8 def result @result end |
Instance Method Details
#duration ⇒ Object
34 35 36 37 38 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 34 def duration return 0 if count.zero? total_duration / count end |
#key ⇒ Object
30 31 32 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 30 def key :summary_group end |
#total_duration ⇒ Object
40 41 42 |
# File 'lib/trace_viz/trace_data/summary_node.rb', line 40 def total_duration children.map(&:duration).sum end |