diff options
author | Delan Azabani <dazabani@igalia.com> | 2024-11-22 21:31:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-22 13:31:00 +0000 |
commit | 3a32af0c852fc14571a59b0ef2d3820317fed4ab (patch) | |
tree | 8c810fe3d01197ee87cda9e7414de6cbf3a06c86 | |
parent | fd3af6ad04d9e1e1acf6c36da9327ff79fcde8d4 (diff) | |
download | servo-3a32af0c852fc14571a59b0ef2d3820317fed4ab.tar.gz servo-3a32af0c852fc14571a59b0ef2d3820317fed4ab.zip |
Plumb URL into interval profiler tracing events (#34337)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
-rw-r--r-- | components/script/dom/bindings/settings_stack.rs | 7 | ||||
-rw-r--r-- | components/shared/profile/lib.rs | 9 | ||||
-rw-r--r-- | components/shared/profile/time.rs | 6 | ||||
-rw-r--r-- | ports/servoshell/lib.rs | 3 |
4 files changed, 21 insertions, 4 deletions
diff --git a/components/script/dom/bindings/settings_stack.rs b/components/script/dom/bindings/settings_stack.rs index 7cd157a612f..3da1db5f6f6 100644 --- a/components/script/dom/bindings/settings_stack.rs +++ b/components/script/dom/bindings/settings_stack.rs @@ -59,7 +59,12 @@ impl AutoEntryScript { AutoEntryScript { global: DomRoot::from_ref(global), #[cfg(feature = "tracing")] - span: tracing::info_span!("ScriptEvaluate", servo_profiling = true).entered(), + span: tracing::info_span!( + "ScriptEvaluate", + servo_profiling = true, + url = global.get_url().to_string(), + ) + .entered(), } }) } 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. diff --git a/ports/servoshell/lib.rs b/ports/servoshell/lib.rs index 8e19e055265..c55d6926cb5 100644 --- a/ports/servoshell/lib.rs +++ b/ports/servoshell/lib.rs @@ -50,7 +50,8 @@ pub fn init_tracing() { // The servo.pftrace file can be uploaded to https://ui.perfetto.dev for analysis. let file = std::fs::File::create("servo.pftrace").unwrap(); let perfetto_layer = tracing_perfetto::PerfettoLayer::new(std::sync::Mutex::new(file)) - .with_filter_by_marker(|field_name| field_name == "servo_profiling"); + .with_filter_by_marker(|field_name| field_name == "servo_profiling") + .with_debug_annotations(true); subscriber.with(perfetto_layer) }; |