Closed Bug 1565137 Opened 3 years ago Closed 3 years ago

Implement thread-safe circular buffer with variable-sized entries

Categories

(Core :: Gecko Profiler, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: gerald, Assigned: gerald)

References

Details

Attachments

(1 file)

This bug adds to the byte-oriented ModuloBuffer from bug 1563425:

  • Thread-safety: All APIs may be called at any time from any thread.
  • Structure: The buffer will be divided in "blocks" of different size, with some block meta-data and space for the user "entry".
  • Capable of handling user resources: The user may provide a "deleter" that will be informed about soon-to-be-destroyed entries; so if some entries reference outside resources, these references may be properly released.

Note: This first implementation still only allows the user to manipulate bytes and trivially-copyable objects (same as with the ModuloBuffer iterators). A follow-up bug will introduce better serialization capabilities, with the aim to eventually store everything that current Profiler Markers and their payloads contain.

This adds to the byte-oriented ModuloBuffer from bug 1563425:

  • Thread-safety: All APIs may be called at any time from any thread.
  • Structure: The buffer will be divided in "blocks" of different size, with some
    block meta-data and space for the user "entry".
  • Capable of handling user resources: The user may provide a "deleter" that will
    be informed about soon-to-be-destroyed entries; so if some entries reference
    outside resources, these references may be properly released.

Note: This first implementation still only allows the user to manipulate bytes
and trivially-copyable objects (same as with the ModuloBuffer iterators). A
follow-up bug will introduce better serialization capabilities, with the aim to
eventually store everything that current Profiler Markers and their payloads
contain.

Pushed by gsquelart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ab9dfd8e9360
BlocksRingBuffer is a thread-safe variable-sized circular buffer - r=gregtatum
Blocks: 1566706
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Regressions: 1567861
Depends on: 1571292
No longer depends on: 1571292
Regressions: 1571292
You need to log in before you can comment on or make changes to this bug.