Plumb selected tracing spans into hitrace (#33324)

* Plumb selected tracing spans into hitrace

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Tag the spans in #33189 with the `servo_profiling` field

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Add comment about fields vs extensions

Signed-off-by: Delan Azabani <dazabani@igalia.com>

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
Delan Azabani 2024-09-10 17:03:55 +08:00 committed by GitHub
parent d4be678a69
commit 6d6cd0f2dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 162 additions and 11 deletions

View file

@ -682,7 +682,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
/// Accept messages from content processes that need to be relayed to the WebRender
/// instance in the parent process.
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
fn handle_webrender_message(&mut self, msg: ForwardedToCompositorMsg) {
match msg {
ForwardedToCompositorMsg::Layout(ScriptToCompositorMsg::SendInitialTransaction(
@ -770,7 +770,11 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
display_list_descriptor,
);
let span = span!(Level::TRACE, "ScriptToCompositorMsg::BuiltDisplayList");
let span = span!(
Level::TRACE,
"ScriptToCompositorMsg::BuiltDisplayList",
servo_profiling = true
);
let _enter = span.enter();
let pipeline_id = display_list_info.pipeline_id;
let details = self.pipeline_details(pipeline_id.into());
@ -2058,7 +2062,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
/// Returns Ok if composition was performed or Err if it was not possible to composite for some
/// reason. When the target is [CompositeTarget::SharedMemory], the image is read back from the
/// GPU and returned as Ok(Some(png::Image)), otherwise we return Ok(None).
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
fn composite_specific_target(
&mut self,
target: CompositeTarget,
@ -2271,7 +2275,11 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
},
};
let span = span!(Level::TRACE, "ConstellationMsg::ReadyToPresent");
let span = span!(
Level::TRACE,
"ConstellationMsg::ReadyToPresent",
servo_profiling = true
);
let _enter = span.enter();
// Notify embedder that servo is ready to present.
// Embedder should call `present` to tell compositor to continue rendering.
@ -2297,9 +2305,13 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
.map(|info| info.framebuffer_id())
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
pub fn present(&mut self) {
let span = span!(Level::TRACE, "Compositor Present Surface");
let span = span!(
Level::TRACE,
"Compositor Present Surface",
servo_profiling = true
);
let _enter = span.enter();
if let Err(err) = self.rendering_context.present() {
warn!("Failed to present surface: {:?}", err);
@ -2362,7 +2374,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
);
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
pub fn receive_messages(&mut self) -> bool {
// Check for new messages coming from the other threads in the system.
let mut compositor_messages = vec![];
@ -2389,7 +2401,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
true
}
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
pub fn perform_updates(&mut self) -> bool {
if self.shutdown_state == ShutdownState::FinishedShuttingDown {
return false;