QA/Automation/Projects/Addons/MemChaser/Future Features

From MozillaWiki
< QA‎ | Automation‎ | Projects‎ | Addons‎ | MemChaser
Jump to: navigation, search

Circular Buffer

Usage/Overview

  • Main data structure for graphs
  • Stores temporary GC (and CC,etc.) values
  • Conceptually is a linked list with a cycle from the tail to head, but it would be implemented using an array in JavaScript

Requirements

  • Have as little impact on garbage collection as possible
  • Have read/write capabilities with events emitted from writes
  • Read operations should not post-increment head index and should not delete the element being read

Current Proposal

Source

https://github.com/dglol/memchaser/blob/circular-buffer/extension/lib/circular-buffer.js

Fields

  • front
    • index for the front of the buffer
  • back
    • index for the back of the buffer
  • buffer
    • array building block for this data structure

Methods

  • CircularBuffer(length) (Constructor)
    • only required a length to initialize
    • length defaults to 1 if a undefined value or negative number is given
  • size() (Necessary)
    • returns the size of the buffer
  • read([index]) (Necessary)
    • returns data from [head + index] if a positive index is given
    • else it returns the data at [head] (i.e. index = 0)
    • if index is negative, then it returns data from [tail + index]
  • write(data)/push(data) (Necessary)
    • writes data at the [tail] then increments tail index by one
    • emits an event 'bufferWrite'
  • pop() (Optional)
    • returns data from [tail] then decrements tail by one
  • shift() (Optional)
    • reads from [head], removes the data at [head] and increments head by one
  • unshift(data) (Optional)
    • decrements head by one, then writes the data at head
  • clear() (Optional)
    • resets the buffer, head index and tail index
  • flush() (Not yet implemented)
    • clears the buffer and dumps data onto an array, and sends it

Discussion items

JSON Blob vs Separate Buffers

  • A JSON Blob of all the data ({gc: , cc:, etc}) has less overhead but writes would have to be synchronous
  • GC and related data occur at different times, so separate buffers allows asynchronous writing

GC/CC Parser

HTML5/Canvas

History Graph

Usage/Overview

  • Uses the circular buffer as a data structure to hold data points
  • Data points are obtained from listening to the event generated by CircularBuffer.Write()
  • Data is represented by a bar chart
    • X axis represents the last n data points, where n represents the latest data point
  • Data falls off after the circular buffer is full

Moving Graph

Usage/Overview

  • Uses the circular buffer as a data structure to hold data points
  • Data points are obtained from listening to the event generated by CircularBuffer.Write()
  • Data is represented by a line chart
    • X axis represents the last n seconds, where n represents the latest data point
  • Data falls off every second

Time Calculations

Memory Report per Compartment

Blocked by https://bugzilla.mozilla.org/show_bug.cgi?id=687724