diff options
author | Josh Matthews <josh@joshmatthews.net> | 2019-03-22 13:15:50 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2019-03-26 16:35:08 -0400 |
commit | 90f67c11e5de39341b8b212a022ce997f9382eb3 (patch) | |
tree | 391e8643504f957e26d6abaf1eee62eba3f52513 /components/constellation | |
parent | db7bb2a5101ea6042654b59b3b81725e2da65891 (diff) | |
download | servo-90f67c11e5de39341b8b212a022ce997f9382eb3.tar.gz servo-90f67c11e5de39341b8b212a022ce997f9382eb3.zip |
Add a sampling profiler and a script to generate profiles for use with Gecko tooling.
Diffstat (limited to 'components/constellation')
-rw-r--r-- | components/constellation/constellation.rs | 23 | ||||
-rw-r--r-- | components/constellation/pipeline.rs | 8 |
2 files changed, 19 insertions, 12 deletions
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index e4120579912..7dc9074eb2f 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -124,7 +124,7 @@ use keyboard_types::webdriver::Event as WebDriverInputEvent; use keyboard_types::KeyboardEvent; use layout_traits::LayoutThreadFactory; use log::{Level, LevelFilter, Log, Metadata, Record}; -use msg::constellation_msg::{BackgroundHangMonitorRegister, HangAlert}; +use msg::constellation_msg::{BackgroundHangMonitorRegister, HangMonitorAlert}; use msg::constellation_msg::{ BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId, }; @@ -210,11 +210,11 @@ pub struct Constellation<Message, LTF, STF> { /// A channel for the background hang monitor to send messages /// to the constellation. - background_hang_monitor_sender: IpcSender<HangAlert>, + background_hang_monitor_sender: IpcSender<HangMonitorAlert>, /// A channel for the constellation to receiver messages /// from the background hang monitor. - background_hang_monitor_receiver: Receiver<Result<HangAlert, IpcError>>, + background_hang_monitor_receiver: Receiver<Result<HangMonitorAlert, IpcError>>, /// An IPC channel for layout threads to send messages to the constellation. /// This is the layout threads' view of `layout_receiver`. @@ -942,7 +942,7 @@ where #[derive(Debug)] enum Request { Script((PipelineId, FromScriptMsg)), - BackgroundHangMonitor(HangAlert), + BackgroundHangMonitor(HangMonitorAlert), Compositor(FromCompositorMsg), Layout(FromLayoutMsg), NetworkListener((PipelineId, FetchResponseMsg)), @@ -1008,10 +1008,17 @@ where } } - fn handle_request_from_background_hang_monitor(&self, message: HangAlert) { - // TODO: In case of a permanent hang being reported, add a "kill script" workflow, - // via the embedder? - warn!("Component hang alert: {:?}", message); + fn handle_request_from_background_hang_monitor(&self, message: HangMonitorAlert) { + match message { + HangMonitorAlert::Profile(bytes) => self + .embedder_proxy + .send((None, EmbedderMsg::ReportProfile(bytes))), + HangMonitorAlert::Hang(hang) => { + // TODO: In case of a permanent hang being reported, add a "kill script" workflow, + // via the embedder? + warn!("Component hang alert: {:?}", hang); + }, + } } fn handle_request_from_network_listener(&mut self, message: (PipelineId, FetchResponseMsg)) { diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index be369c0c08e..4e9d795d459 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -18,7 +18,7 @@ use ipc_channel::Error; use layout_traits::LayoutThreadFactory; use metrics::PaintTimeMetrics; use msg::constellation_msg::TopLevelBrowsingContextId; -use msg::constellation_msg::{BackgroundHangMonitorRegister, HangAlert}; +use msg::constellation_msg::{BackgroundHangMonitorRegister, HangMonitorAlert}; use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId, PipelineNamespaceId}; use net::image_cache::ImageCacheImpl; use net_traits::image_cache::ImageCache; @@ -122,7 +122,7 @@ pub struct InitialPipelineState { pub background_monitor_register: Option<Box<BackgroundHangMonitorRegister>>, /// A channel for the background hang monitor to send messages to the constellation. - pub background_hang_monitor_to_constellation_chan: IpcSender<HangAlert>, + pub background_hang_monitor_to_constellation_chan: IpcSender<HangMonitorAlert>, /// A channel for the layout thread to send messages to the constellation. pub layout_to_constellation_chan: IpcSender<LayoutMsg>, @@ -467,7 +467,7 @@ pub struct UnprivilegedPipelineContent { parent_pipeline_id: Option<PipelineId>, opener: Option<BrowsingContextId>, script_to_constellation_chan: ScriptToConstellationChan, - background_hang_monitor_to_constellation_chan: IpcSender<HangAlert>, + background_hang_monitor_to_constellation_chan: IpcSender<HangMonitorAlert>, layout_to_constellation_chan: IpcSender<LayoutMsg>, scheduler_chan: IpcSender<TimerSchedulerMsg>, devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>, @@ -669,7 +669,7 @@ impl UnprivilegedPipelineContent { } } - pub fn background_hang_monitor_to_constellation_chan(&self) -> &IpcSender<HangAlert> { + pub fn background_hang_monitor_to_constellation_chan(&self) -> &IpcSender<HangMonitorAlert> { &self.background_hang_monitor_to_constellation_chan } |