tools: Improve instrumentation and add it for some layout (#33647)

Improves the instrumentation to skip all function arguments and also add
spans for some layout modes. This is preparation for improving the
performance of flexbox.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2024-10-05 10:55:40 +02:00 committed by GitHub
parent 20eb927843
commit 719b5aba24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 140 additions and 115 deletions

View file

@ -36,7 +36,7 @@ use script_traits::{
};
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use tracing::{span, Level};
use tracing::{instrument, span, Level};
use webrender::{CaptureBits, RenderApi, Transaction};
use webrender_api::units::{
DeviceIntPoint, DeviceIntSize, DevicePoint, DeviceRect, LayoutPoint, LayoutRect, LayoutSize,
@ -684,7 +684,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), fields(servo_profiling = true))]
#[instrument(skip_all, fields(servo_profiling = true))]
fn handle_webrender_message(&mut self, msg: ForwardedToCompositorMsg) {
match msg {
ForwardedToCompositorMsg::Layout(ScriptToCompositorMsg::SendInitialTransaction(
@ -2056,7 +2056,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), fields(servo_profiling = true))]
#[instrument(skip_all, fields(servo_profiling = true))]
fn composite_specific_target(
&mut self,
target: CompositeTarget,
@ -2299,7 +2299,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
.map(|info| info.framebuffer_id())
}
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
#[instrument(skip_all, fields(servo_profiling = true))]
pub fn present(&mut self) {
let span = span!(
Level::TRACE,
@ -2368,7 +2368,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
);
}
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
#[instrument(skip_all, 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![];
@ -2395,7 +2395,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
true
}
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
#[instrument(skip_all, fields(servo_profiling = true))]
pub fn perform_updates(&mut self) -> bool {
if self.shutdown_state == ShutdownState::FinishedShuttingDown {
return false;