QA/Automation/Projects/Addons/MemChaser/Future Features: Difference between revisions

From MozillaWiki
< QA‎ | Automation‎ | Projects‎ | Addons‎ | MemChaser
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:


==== Fields ====
==== Fields ====
* head
* front
** index for the head/front of the buffer
** index for the front of the buffer


* tail
* back
** index for the tail/back of the buffer
** index for the back of the buffer


* buffer
* buffer
Line 33: Line 33:


* read([index]) (Necessary)
* read([index]) (Necessary)
** returns data from [head + index] if index is given
** returns data from [head + index] if a positive index is given
** else it returns the data at [head] (i.e. index = 0)
** else it returns the data at [head] (i.e. index = 0)
** if index is negative, then it returns data from [tail + index]


* write(data) (Necessary)
* write(data)/push(data) (Necessary)
** writes data at the [tail] then increments tail index by one
** writes data at the [tail] then increments tail index by one
** emits an event 'bufferWrite'
** emits an event 'bufferWrite'


* clear() (Optional)
* pop() (Optional)
** resets the buffer, head index and tail index
** returns data from [tail] then decrements tail by one


* shift() (Optional)
* shift() (Optional)
** reads from [head], removes the data at [head] and increments head by one
** reads from [head], removes the data at [head] and increments head by one


* last() (Optional)
* unshift(data) (Optional)
** reads from [tail]
** 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 ===
=== Discussion items ===

Revision as of 01:01, 1 February 2012

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