QA/Automation/Projects/Addons/MemChaser/Future Features
< QA | Automation | Projects | Addons | MemChaser
Jump to navigation
Jump to 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
- head
- index for the head/front of the buffer
- tail
- index for the tail/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 index is given
- else it returns the data at [head] (i.e. index = 0)
- write(data) (Necessary)
- writes data at the [tail] then increments tail index by one
- emits an event 'bufferWrite'
- clear() (Optional)
- resets the buffer, head index and tail index
- shift() (Optional)
- reads from [head], removes the data at [head] and increments head by one
- last() (Optional)
- reads from [tail]
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