Implement ProfileChunkedBuffer
Categories
(Core :: Gecko Profiler, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox77 | --- | fixed |
People
(Reporter: mozbugz, Assigned: mozbugz)
References
(Blocks 2 open bugs)
Details
Attachments
(8 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
ProfileChunkedBuffer
simulates a near-infinite buffer over ProfileBufferChunk
s.
It uses a ProfileBufferChunkManager
to get chunks and later release them.
Its use is similar to BlocksRingBuffer
:
- It reserves blocks in chunks, adds some structure (just the size of the entry that follows), and lets a user-provided writer write the entry.
- It allows reading past entries.
- It can be in an "out-of-session" state where APIs are still available but do nothing.
It is intended to be a replacement for BlocksRingBuffer
.
Assignee | ||
Comment 1•5 years ago
|
||
ProfileBuffer
used to check if a BlocksRingBuffer
was in session by looking
at its buffer size.
Now IsInSession()
should be used, it is clearer in intent, and will make the
transition to ProfileChunkedBuffer
slightly easier.
Assignee | ||
Comment 2•5 years ago
|
||
ProfileChunkedBuffer simulates a near-infinite buffer over ProfileBufferChunks.
It uses a ProfileBufferChunkManager to get chunks and later release them.
Its use is similar to BlocksRingBuffer:
- It reserves blocks in chunks, adds some structure (just the size of the entry
that follows), and lets a user-provided writer write the entry. - It allows reading past entries.
- It can be in an "out-of-session" state where APIs are still available but do
nothing.
It is intended to eventually replace BlocksRingBuffer.
This patch starts with the basic structure, following patches will add all
planned features.
Depends on D69492
Assignee | ||
Comment 3•5 years ago
|
||
ProfileChunkedBuffer
can handle zero of one ProfileBufferChunkManager
at a
time, and can optionally take ownership of the manager.
Depends on D69493
Assignee | ||
Comment 4•5 years ago
|
||
To ensure that a spare chunk is ready to handle data that will eventually
overflow the current chunk, ProfileChunkedBuffer
uses
ProfileBufferChunk::RequestChunk()
to queue a request for a new chunk.
This request should be handled off-thread by the buffer user -- but a response
is not guaranteed, so the buffer does not rely on it and can get a new chunk
on the spot if really needed.
Because the request is asynchronous, and because either the buffer or the user
could be destroyed while a request is in flight, a shared
RequestedChunkRefCountedHolder
object is used:
- When the request is handled, the new chunk (or nullptr) is given to the
holder. - When the buffer needs a new chunk, it can retrieve the new chunk if the
request was successfully fulfilled.
If the requestee is destroyed first, the request won't be fulfilled and the
buffer will carry on without relying on requests.
If the requester is destroyed first, the holder (with a potential requested
chunk) will just get destroyed after the request is fulfilled or the requestee
is destroyed as well.
Depends on D69494
Assignee | ||
Comment 5•5 years ago
|
||
Depends on D69495
Assignee | ||
Comment 6•5 years ago
|
||
InChunkPointer
is an internal accessor pointing at a position inside a chunk.
It can handle up to two groups of chunks (typically the extant chunks stored in
the chunk manager, and the current chunk.
Depends on D69496
Assignee | ||
Comment 7•5 years ago
|
||
Depends on D69497
Assignee | ||
Comment 8•5 years ago
|
||
This is needed to embed a small buffer (e.g., containing one backtrace attached
to a marker) into a bigger buffer (e.g., the main profiler buffer).
Depends on D69498
Comment 10•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/e207f1d1f211
https://hg.mozilla.org/mozilla-central/rev/e4f1e52ecd5b
https://hg.mozilla.org/mozilla-central/rev/3df5df7105cd
https://hg.mozilla.org/mozilla-central/rev/c8e55e1a9e86
https://hg.mozilla.org/mozilla-central/rev/a1edf5289acd
https://hg.mozilla.org/mozilla-central/rev/7ab49e4c1621
https://hg.mozilla.org/mozilla-central/rev/f6a19e0ba1a9
https://hg.mozilla.org/mozilla-central/rev/8243d7c3eeaf
Description
•