Closed Bug 1563425 Opened 5 years ago Closed 5 years ago

Implement basic circular byte buffer with iterator and LEB128 helpers

Categories

(Core :: Gecko Profiler, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox69 --- wontfix
firefox70 --- fixed

People

(Reporter: mozbugz, Assigned: mozbugz)

References

Details

Attachments

(1 file)

The new ProfileBuffer underlying buffer will store variable-sized entries in a circular buffer.

That fancy circular buffer will itself use an underlying circular byte buffer, to better separate responsibilities.

Basic usage: (Silly examples)

  • Create buffer: ModuloBuffer mb(PowerOfTwo);
  • Get iterator: auto writer = mb.WriterAt(Index); (or ReaderAt())
  • Basic iterator functions on bytes: *++writer = 'x';
  • Write: writer.WriteULEB128(sizeof(int)); writer.WriteObject<int>(42);
  • Comparisons, move: while (writer > reader) { --writer; }
  • Read: size_t s = reader.ReadLEB128<size_t>(); int i = ReadObject<int>();

There are no safety checks, it will be up to the caller to ensure thread-safety,
and data safety when wrapping around the buffer.

Pushed by gsquelart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3f48535246db
ModuloBuffer is a basic circular byte buffer with iterator and LEB128 helpers - r=gregtatum
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: