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

@ -45,6 +45,7 @@ servo_config = { path = "../config" }
servo_geometry = { path = "../geometry" }
servo_url = { path = "../url" }
style = { workspace = true }
tracing = { workspace = true }
style_traits = { workspace = true }
unicode-bidi = { workspace = true }
unicode-script = { workspace = true }

View file

@ -19,6 +19,7 @@ use style::values::generics::flex::GenericFlexBasis as FlexBasis;
use style::values::generics::length::{GenericLengthPercentageOrAuto, LengthPercentageOrNormal};
use style::values::specified::align::AlignFlags;
use style::Zero;
use tracing::instrument;
use super::geom::{FlexAxis, FlexRelativeRect, FlexRelativeSides, FlexRelativeVec2};
use super::{FlexContainer, FlexContainerConfig, FlexItemBox, FlexLevelBox};
@ -338,6 +339,11 @@ struct FlexItemBoxInlineContentSizesInfo {
}
impl FlexContainer {
#[instrument(
name = "FlexContainer::inline_content_sizes",
skip_all,
fields(servo_profiling = true)
)]
pub fn inline_content_sizes(
&mut self,
layout_context: &LayoutContext,
@ -531,6 +537,11 @@ impl FlexContainer {
}
/// <https://drafts.csswg.org/css-flexbox/#layout-algorithm>
#[instrument(
name = "FlexContainer::layout",
skip_all,
fields(servo_profiling = true)
)]
pub(crate) fn layout(
&self,
layout_context: &LayoutContext,
@ -2461,6 +2472,11 @@ impl FlexItemBox {
}
#[allow(clippy::too_many_arguments)]
#[instrument(
name = "FlexContainer::layout_for_block_content_size",
skip_all,
fields(servo_profiling = true)
)]
fn layout_for_block_content_size(
&mut self,
flex_context: &FlexContext,

View file

@ -24,6 +24,7 @@ use style::values::computed::{
use style::values::generics::box_::{GenericVerticalAlign as VerticalAlign, VerticalAlignKeyword};
use style::values::generics::length::GenericLengthPercentageOrAuto::{Auto, LengthPercentage};
use style::Zero;
use tracing::instrument;
use super::{Table, TableCaption, TableSlot, TableSlotCell, TableTrack, TableTrackGroup};
use crate::context::LayoutContext;
@ -1630,6 +1631,7 @@ impl<'a> TableLayout<'a> {
/// Lay out the table (grid and captions) of this [`TableLayout`] into fragments. This should
/// only be be called after calling [`TableLayout.compute_measures`].
#[instrument(name = "Table::layout", skip_all, fields(servo_profiling = true))]
fn layout(
mut self,
layout_context: &LayoutContext,
@ -2601,6 +2603,11 @@ impl Table {
}
}
#[instrument(
name = "Table::inline_content_sizes",
skip_all,
fields(servo_profiling = true)
)]
pub(crate) fn inline_content_sizes(
&mut self,
layout_context: &LayoutContext,