Add better access to markers from Rust
Categories
(Core :: Gecko Profiler, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox94 | --- | fixed |
People
(Reporter: mozbugz, Assigned: canova)
References
(Blocks 2 open bugs)
Details
Attachments
(11 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
Bug 1654413 - Add a MarkerTiming and MarkerOptions Rust structs for the marker API r?emilio!,gerald!
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
There are already some simple hooks in https://searchfox.org/mozilla-central/rev/3b6958c26049c1e27b2790a43154caaba9f6dd4a/gfx/webrender_bindings/src/bindings.rs#847
After meta bug 1640956 lands (or at least bug 1646266), it would be useful to offer more complete access to profiler markers.
But since the new C++ API is templated and variadic, I don't think it's possible to just add bindings. I'm thinking that it may be possible to create a similar generic interface in Rust, and have it serialize the input the same way C++ does (it's really only C PODs and strings in the profile buffer) and pass binary blobs to C++; The later JSONification will need more thoughts!
Newbie disclaimer: I haven't coded anything real in Rust yet, so I may be wrong about many things, don't trust me!
| Assignee | ||
Comment 1•4 years ago
|
||
For some reason, I thought that parse_callbacks(Box::new(CargoCallbacks))
would also automatically adds the initial header files that are manually added.
But apparently parse_callbacks is only executed when the inner included
header files are found.
| Assignee | ||
Comment 2•4 years ago
|
||
This will be used to get the time from profiler, so marker API can use it to
understand the start or end time.
Depends on D124017
| Assignee | ||
Comment 3•4 years ago
|
||
This is a syntactical sugar to write the categories more easily. I prefer to
have this macro because this is the same syntax as the categories in the label
frames API.
Depends on D124018
| Assignee | ||
Comment 4•4 years ago
|
||
These structs are needed for the marker APIs. We also have the same structs as
the C++ classes. See mozilla::MarkerTiming and mozilla::MarkerOptions.
Depends on D124019
| Assignee | ||
Comment 5•4 years ago
|
||
MarkerStack object is a bit more complex in the C++ side. But we don't need a
complex object like that in here. A simple enum is enough to determine what
type of marker stack we are capturing. C++ side will be handling the capturing
of the stack.
Depends on D124020
| Assignee | ||
Comment 6•4 years ago
|
||
This is the first and simplest API for the markers. There will be two more
APIs in the following patches (add_text_marker and add_marker). You can see the
PROFILER_MARKER_UNTYPED macro for the C++ counterpart.
Depends on D124021
| Assignee | ||
Comment 7•4 years ago
|
||
This is the second API for the markers. This allows one payload as a text for
more information. See the PROFILER_MARKER_TEXT macro for the C++ counterpart.
Depends on D124022
| Assignee | ||
Comment 8•4 years ago
|
||
JSON writer will be used for the third and last marker API. This is needed
because we need to describe a marker payload struct on how to serialize it.
Depends on D124023
| Assignee | ||
Comment 9•4 years ago
|
||
You can see the mozilla::MarkerSchema for the C++ counterpart. This Rust
struct simply wraps the C++ object and keeps the reference of it as RAII. This
heap allocates the inner C++ object but it's fine to do it here, because it's
we only create a MarkerSchema object at the end of a profiling session and it
happens once per marker type. It should be very rare.
Depends on D124024
| Assignee | ||
Comment 10•4 years ago
|
||
This only adds the API and then adds the profiler payload to the buffer. The
deserialization and streaming will happen in the next patch.
Depends on D124025
| Assignee | ||
Comment 11•4 years ago
|
||
Now we can deserialize and stream everything to the JSON.
Depends on D124026
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
| Assignee | ||
Updated•4 years ago
|
Comment 12•4 years ago
|
||
Comment 13•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/6974cc158d51
https://hg.mozilla.org/mozilla-central/rev/57fe3b6c0acf
https://hg.mozilla.org/mozilla-central/rev/99e2adc9f848
https://hg.mozilla.org/mozilla-central/rev/36660c399584
https://hg.mozilla.org/mozilla-central/rev/89debdc6aaac
https://hg.mozilla.org/mozilla-central/rev/c82aee76d44d
https://hg.mozilla.org/mozilla-central/rev/fde7a635924e
https://hg.mozilla.org/mozilla-central/rev/680cd33b1642
https://hg.mozilla.org/mozilla-central/rev/65e0c7376519
https://hg.mozilla.org/mozilla-central/rev/5ac58c00d75b
https://hg.mozilla.org/mozilla-central/rev/8d2ac26f5f6f
Description
•