From 85a9ca7cb6b850f24c06a4bee71a9f61100f1d0c Mon Sep 17 00:00:00 2001 From: atbrakhi Date: Fri, 8 Nov 2024 10:05:07 +0100 Subject: [PATCH] layout: Add instrumentation for `display_list` (#34128) * Add instrumentation for display_list Signed-off-by: atbrakhi * review update Signed-off-by: atbrakhi * review fix Signed-off-by: atbrakhi --------- Signed-off-by: atbrakhi --- components/layout_2020/display_list/clip_path.rs | 8 ++++++++ components/layout_2020/display_list/mod.rs | 4 ++++ components/layout_2020/display_list/stacking_context.rs | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/components/layout_2020/display_list/clip_path.rs b/components/layout_2020/display_list/clip_path.rs index 299de01ad2a..0a0b40bc7fd 100644 --- a/components/layout_2020/display_list/clip_path.rs +++ b/components/layout_2020/display_list/clip_path.rs @@ -65,6 +65,14 @@ pub(super) fn build_clip_path_clip_chain_if_necessary( } } +#[cfg_attr( + feature = "tracing", + tracing::instrument( + name = "display_list::build_simple_shape", + skip_all, + fields(servo_profiling = true) + ) +)] fn build_simple_shape( shape: BasicShape, layout_box: LayoutRect, diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index baf0cd890be..34c54a10848 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -181,6 +181,10 @@ impl DisplayList { fragment_tree: &FragmentTree, root_stacking_context: &StackingContext, ) -> (FnvHashMap>, bool) { + #[cfg(feature = "tracing")] + let span = tracing::span!(tracing::Level::TRACE, "display_list::build"); + #[cfg(feature = "tracing")] + let _enter = span.enter(); let mut builder = DisplayListBuilder { current_scroll_node_id: self.compositor_info.root_reference_frame_id, current_reference_frame_scroll_node_id: self.compositor_info.root_reference_frame_id, diff --git a/components/layout_2020/display_list/stacking_context.rs b/components/layout_2020/display_list/stacking_context.rs index 1571dd999ca..8ba4794b0d9 100644 --- a/components/layout_2020/display_list/stacking_context.rs +++ b/components/layout_2020/display_list/stacking_context.rs @@ -101,6 +101,14 @@ impl DisplayList { SpatialTreeItemKey::new(pipeline_tag, self.spatial_tree_count) } + #[cfg_attr( + feature = "tracing", + tracing::instrument( + name = "display_list::build_stacking_context_tree", + skip_all, + fields(servo_profiling = true) + ) + )] pub fn build_stacking_context_tree( &mut self, fragment_tree: &FragmentTree,