From 3a32af0c852fc14571a59b0ef2d3820317fed4ab Mon Sep 17 00:00:00 2001 From: Delan Azabani Date: Fri, 22 Nov 2024 21:31:00 +0800 Subject: Plumb URL into interval profiler tracing events (#34337) Signed-off-by: Delan Azabani --- components/shared/profile/lib.rs | 9 +++++++-- components/shared/profile/time.rs | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'components/shared/profile') diff --git a/components/shared/profile/lib.rs b/components/shared/profile/lib.rs index fef2b255bea..4e3aa1fc35d 100644 --- a/components/shared/profile/lib.rs +++ b/components/shared/profile/lib.rs @@ -18,10 +18,15 @@ pub mod time; #[macro_export] macro_rules! time_profile { ($category:expr, $meta:expr, $profiler_chan:expr, $($callback:tt)+) => {{ + let meta: Option<$crate::time::TimerMetadata> = $meta; #[cfg(feature = "tracing")] - let span = tracing::info_span!($category.variant_name(), servo_profiling = true); + let span = tracing::info_span!( + $category.variant_name(), + servo_profiling = true, + url = meta.as_ref().map(|m| m.url.clone()), + ); #[cfg(not(feature = "tracing"))] let span = (); - $crate::time::profile($category, $meta, $profiler_chan, span, $($callback)+) + $crate::time::profile($category, meta, $profiler_chan, span, $($callback)+) }}; } diff --git a/components/shared/profile/time.rs b/components/shared/profile/time.rs index ef36478e9ea..de7b6d2332c 100644 --- a/components/shared/profile/time.rs +++ b/components/shared/profile/time.rs @@ -55,10 +55,16 @@ pub enum ProfilerMsg { Exit(IpcSender<()>), } +/// Usage sites of variants marked “Rust tracing only” are not visible to rust-analyzer. #[repr(u32)] #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum ProfilerCategory { + /// The compositor is rasterising or presenting. + /// + /// Not associated with a specific URL. Compositing = 0x00, + + /// The script thread is doing layout work. LayoutPerform = 0x10, /// Events currently only used by Layout 2013. -- cgit v1.2.3