class NewRelic::Agent::Threading::BacktraceNode

Attributes

as_array[R]
depth[RW]
file[R]
line_no[R]
method[R]
raw_line[R]
runnable_count[RW]

Public Class Methods

new(line) click to toggle source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 85
def initialize(line)
  super()
  @raw_line = line
  @children = []
  @runnable_count = 0
end

Public Instance Methods

==(other) click to toggle source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 92
def ==(other)
  (
    @raw_line       == other.raw_line &&
    @depth          == other.depth    &&
    @runnable_count == other.runnable_count
  )
end
complete_array_conversion() click to toggle source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 106
def complete_array_conversion
  child_arrays = @children.map { |c| c.as_array }.compact

  file, method, line = parse_backtrace_frame(@raw_line)

  @as_array << [string(file), string(method), line ? int(line) : UNKNOWN_LINE_NUMBER]
  @as_array << int(@runnable_count)
  @as_array << 0
  @as_array << child_arrays
end
dump_string(indent=0) click to toggle source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 117
def dump_string(indent=0)
  @file, @method, @line_no = parse_backtrace_frame(@raw_line)
  result = "#{" " * indent}#<BacktraceNode:#{object_id} [#{@runnable_count}] #{@file}:#{@line_no} in #{@method}>"
  child_results = @children.map { |c| c.dump_string(indent+2) }.join("\n")
  result << "\n" unless child_results.empty?
  result << child_results
end
mark_for_array_conversion() click to toggle source
# File lib/new_relic/agent/threading/backtrace_node.rb, line 100
def mark_for_array_conversion
  @as_array = []
end
parse_backtrace_frame(frame) click to toggle source

Returns [filename, method, line number]

# File lib/new_relic/agent/threading/backtrace_node.rb, line 126
def parse_backtrace_frame(frame)
  frame =~ /([^:]*)(\:(\d+))?\:in `(.*)'/
  [$1, $4, $3] # sic
end