Add tracing events (#33189)

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
atbrakhi 2024-09-05 14:11:12 +02:00 committed by GitHub
parent 37e1c3385e
commit 0f24b8c823
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 34 additions and 0 deletions

View file

@ -41,6 +41,7 @@ servo_geometry = { path = "../geometry" }
servo_url = { path = "../url" }
style_traits = { workspace = true }
time = { workspace = true }
tracing = { workspace = true }
webrender = { workspace = true }
webrender_api = { workspace = true }
webrender_traits = { workspace = true }

View file

@ -34,6 +34,7 @@ use script_traits::{
};
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use tracing::{span, Level};
use webrender::{CaptureBits, RenderApi, Transaction};
use webrender_api::units::{
DeviceIntPoint, DeviceIntSize, DevicePoint, DeviceRect, LayoutPoint, LayoutRect, LayoutSize,
@ -680,6 +681,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))]
fn handle_webrender_message(&mut self, msg: ForwardedToCompositorMsg) {
match msg {
ForwardedToCompositorMsg::Layout(ScriptToCompositorMsg::SendInitialTransaction(
@ -767,6 +769,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
display_list_descriptor,
);
let span = span!(Level::TRACE, "ScriptToCompositorMsg::BuiltDisplayList");
let _enter = span.enter();
let pipeline_id = display_list_info.pipeline_id;
let details = self.pipeline_details(pipeline_id.into());
details.most_recent_display_list_epoch = Some(display_list_info.epoch);
@ -2053,6 +2057,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))]
fn composite_specific_target(
&mut self,
target: CompositeTarget,
@ -2268,6 +2273,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
},
};
let span = span!(Level::TRACE, "ConstellationMsg::ReadyToPresent");
let _enter = span.enter();
// Notify embedder that servo is ready to present.
// Embedder should call `present` to tell compositor to continue rendering.
self.waiting_on_present = true;
@ -2292,7 +2299,10 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
.map(|info| info.framebuffer_id())
}
#[tracing::instrument(skip(self))]
pub fn present(&mut self) {
let span = span!(Level::TRACE, "Compositor Present Surface");
let _enter = span.enter();
if let Err(err) = self.rendering_context.present() {
warn!("Failed to present surface: {:?}", err);
}
@ -2354,6 +2364,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
);
}
#[tracing::instrument(skip(self))]
pub fn receive_messages(&mut self) -> bool {
// Check for new messages coming from the other threads in the system.
let mut compositor_messages = vec![];
@ -2380,6 +2391,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
true
}
#[tracing::instrument(skip(self))]
pub fn perform_updates(&mut self) -> bool {
if self.shutdown_state == ShutdownState::FinishedShuttingDown {
return false;