class TestProf::MemoryProf::Tracker

  • track - a method that fetches the amount of memory in use at a certain point.
    * groups – the top n groups, an instance of Utils::SizedOrderedSet.
    * examples – the top n examples, an instance of Utils::SizedOrderedSet.
    list is an instance of LinkedList (for more info see tracker/linked_list.rb)
    * list - a linked list that is being used to track memmory for individual groups/examples.
    A tracker consists of four main parts:
    AllocTracker and RssTracker.
    the top n examples and groups. There are two types of trackers:
    Tracker is responsible for tracking memory usage and determining

def example_finished(id)

def example_finished(id)
  node = list.remove_node(id, track)
  return unless node
  examples << {**node.item, memory: node.total_memory}
end

def example_started(id, example = id)

def example_started(id, example = id)
  list.add_node(id, example, track)
end

def finish

def finish
  node = list.remove_node(:total, track)
  @total_memory = node.total_memory
end

def group_finished(id)

def group_finished(id)
  node = list.remove_node(id, track)
  return unless node
  groups << {**node.item, memory: node.hooks_memory}
end

def group_started(id, group = id)

def group_started(id, group = id)
  list.add_node(id, group, track)
end

def initialize(top_count)

def initialize(top_count)
  raise "Your Ruby Engine or OS is not supported" unless supported?
  @top_count = top_count
  @examples = Utils::SizedOrderedSet.new(top_count, sort_by: :memory)
  @groups = Utils::SizedOrderedSet.new(top_count, sort_by: :memory)
end

def start

def start
  @list = LinkedList.new(track)
end