Class: Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/agent/frame.rb

Overview

Ruby version of a Frame Object Self-time is not maintained here, only start and end time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, startNanos, endNanos, op, parentFrame = nil, childFrames = []) ⇒ Frame

Returns a new instance of Frame.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/agent/frame.rb', line 11

def initialize(id, startNanos, endNanos, op, parentFrame = nil, childFrames=[])
  @id = id
  @startNanos = startNanos
  @endNanos = endNanos
  @operation = op
  @parent = parentFrame
  @children = childFrames
  if @startNanos >= @endNanos
    raise(ArgumentError, "StartNanos " + ("%d" % @startNanos) + " must be less than EndNanos " + ("%d" % @endNanos), Kernel.caller)
  end
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



23
24
25
# File 'lib/agent/frame.rb', line 23

def children
  @children
end

#endNanosObject

Returns the value of attribute endNanos.



23
24
25
# File 'lib/agent/frame.rb', line 23

def endNanos
  @endNanos
end

#operationObject

Returns the value of attribute operation.



23
24
25
# File 'lib/agent/frame.rb', line 23

def operation
  @operation
end

#parentObject

Returns the value of attribute parent.



23
24
25
# File 'lib/agent/frame.rb', line 23

def parent
  @parent
end

#startNanosObject

Returns the value of attribute startNanos.



23
24
25
# File 'lib/agent/frame.rb', line 23

def startNanos
  @startNanos
end

Instance Method Details

#as_json(*a) ⇒ Object

Used to handle the circular reference for the parent frame



26
27
28
29
30
31
32
33
34
# File 'lib/agent/frame.rb', line 26

def as_json(*a)
  {
    'id' => @id,
    'startNanos' => "%d" %  @startNanos, # must not be in scientific notation
    'endNanos' => "%d" %  @endNanos,
    'operation' => @operation,
    'children' => @children
  }.as_json(*a)
end