Move Base Profiler data to Gecko Profiler instead of copying it twice
Categories
(Core :: Gecko Profiler, task, P3)
Tracking
()
People
(Reporter: mozbugz, Unassigned)
References
(Blocks 1 open bug)
Details
Currently when the Gecko Profiler (GP) starts, it calls the Base Profiler's (BP) profiler_get_profile()
, stores the string and writes it into the final profile.
In more details:
- BP creates a
SpliceableChunkedJSONWriter
, which creates aChunkedJSONWriteFunc
. - BP converts its internal buffer into JSON, in the
SpliceableChunkedJSONWriter
(creating a number ofUniquePtr<char[]>
buffers). - BP converts copies the JSON buffers into a single
UniquePtr<char[]>
string. - GP takes ownership of the string.
- Later, when capturing: GP creates its own
SpliceableChunkedJSONWriter
and stores its JSON data. - GP writes the BP string with the JSON writer.
So we copy the whole BP data twice, at steps 3 and 6.
On slow machines, step 3 can take a few seconds.
Some measurements on Try showed that step 6 can take a full second to operate!
But since both profilers are using a SpliceableChunkedJSONWriter
, it should be possible to keep the BP one as-is (or at least its list of buffers), and later splice it into the GP's. The two full-string copies become moving a vector-of-buffers, which is effectively copying a small number of pointers.
Reporter | ||
Comment 1•2 years ago
|
||
Instead of trying to move the Base Profiler data more efficiently, bug 1753192 will simply not copy/move anything! (There will only be one buffer, usable by both Base and Gecko Profilers.)
Description
•