diff --git a/client/src/lib.rs b/client/src/lib.rs index 8a179e57f0..66fb721872 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -2065,10 +2065,7 @@ impl Client { Ok(()) } - fn handle_messages( - &mut self, - frontend_events: &mut Vec, - ) -> Result { + fn handle_messages(&mut self, frontend_events: &mut Vec) -> Result { let mut cnt = 0; loop { let cnt_start = cnt; diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 7a1027da61..ee8e47d735 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -574,6 +574,7 @@ impl<'a> Widget for Bag<'a> { #[allow(clippy::useless_format)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Bag::update"); let widget::UpdateArgs { state, ui, .. } = args; let i18n = &self.localized_strings; let key_layout = &self.global_state.window.key_layout; diff --git a/voxygen/src/hud/buffs.rs b/voxygen/src/hud/buffs.rs index 12cff265e7..5fc82242df 100644 --- a/voxygen/src/hud/buffs.rs +++ b/voxygen/src/hud/buffs.rs @@ -99,6 +99,7 @@ impl<'a> Widget for BuffsBar<'a> { fn style(&self) -> Self::Style {} fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("BuffsBar::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut event = Vec::new(); let localized_strings = self.localized_strings; diff --git a/voxygen/src/hud/buttons.rs b/voxygen/src/hud/buttons.rs index dce7b90060..71b591d1b1 100644 --- a/voxygen/src/hud/buttons.rs +++ b/voxygen/src/hud/buttons.rs @@ -123,6 +123,7 @@ impl<'a> Widget for Buttons<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Buttons::update"); let widget::UpdateArgs { state, ui, .. } = args; let invs = self.client.inventories(); let inventory = match invs.get(self.client.entity()) { diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index 43283d68a0..2b4c70081a 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -203,6 +203,8 @@ impl<'a> Widget for Chat<'a> { #[allow(clippy::redundant_clone)] // TODO: Pending review in #587 #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Chat::update"); + let widget::UpdateArgs { id, state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/crafting.rs b/voxygen/src/hud/crafting.rs index d2d34f96e5..2013b20ab8 100644 --- a/voxygen/src/hud/crafting.rs +++ b/voxygen/src/hud/crafting.rs @@ -234,6 +234,7 @@ impl<'a> Widget for Crafting<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Crafting::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/diary.rs b/voxygen/src/hud/diary.rs index 96a0cb6fc7..96479dfb46 100644 --- a/voxygen/src/hud/diary.rs +++ b/voxygen/src/hud/diary.rs @@ -260,6 +260,7 @@ impl<'a> Widget for Diary<'a> { fn style(&self) -> Self::Style { () } fn update(mut self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Diary::update"); let widget::UpdateArgs { id: _, state, ui, .. } = args; diff --git a/voxygen/src/hud/esc_menu.rs b/voxygen/src/hud/esc_menu.rs index fb949a249f..a85bde4861 100644 --- a/voxygen/src/hud/esc_menu.rs +++ b/voxygen/src/hud/esc_menu.rs @@ -67,6 +67,7 @@ impl<'a> Widget for EscMenu<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("EscMenu::update"); let widget::UpdateArgs { state, ui, .. } = args; Image::new(self.imgs.esc_frame) diff --git a/voxygen/src/hud/group.rs b/voxygen/src/hud/group.rs index 4145e072f9..fa5c31621e 100644 --- a/voxygen/src/hud/group.rs +++ b/voxygen/src/hud/group.rs @@ -148,6 +148,7 @@ impl<'a> Widget for Group<'a> { #[allow(clippy::unused_unit)] // TODO: Pending review in #587 #[allow(clippy::blocks_in_if_conditions)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Group::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); let localized_strings = self.localized_strings; diff --git a/voxygen/src/hud/map.rs b/voxygen/src/hud/map.rs index 7ea03cf1b8..5e5634d82d 100644 --- a/voxygen/src/hud/map.rs +++ b/voxygen/src/hud/map.rs @@ -194,6 +194,7 @@ impl<'a> Widget for Map<'a> { #[allow(clippy::useless_format)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Map::update"); let widget::UpdateArgs { state, ui, .. } = args; let zoom = self.global_state.settings.interface.map_zoom * 0.8; let show_difficulty = self.global_state.settings.interface.map_show_difficulty; diff --git a/voxygen/src/hud/minimap.rs b/voxygen/src/hud/minimap.rs index 6eabfb7275..4519e87edc 100644 --- a/voxygen/src/hud/minimap.rs +++ b/voxygen/src/hud/minimap.rs @@ -437,6 +437,7 @@ impl<'a> Widget for MiniMap<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Minimap::update"); let mut events = Vec::new(); let widget::UpdateArgs { state, ui, .. } = args; diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index a61df245bc..d409045156 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -88,7 +88,7 @@ use common::{ util::srgba_to_linear, vol::RectRasterableVol, }; -use common_base::span; +use common_base::{prof_span, span}; use common_net::{ msg::{world_msg::SiteId, Notification, PresenceKind}, sync::WorldSyncExt, @@ -977,6 +977,8 @@ impl Hud { let key_layout = &global_state.window.key_layout; if self.show.ingame { + prof_span!("ingame elements"); + let ecs = client.state().ecs(); let pos = ecs.read_storage::(); let stats = ecs.read_storage::(); @@ -1912,63 +1914,65 @@ impl Hud { // Temporary Example Quest let arrow_ani = (self.pulse * 4.0/* speed factor */).cos() * 0.5 + 0.8; //Animation timer + let show_intro = self.show.intro; // borrow check doesn't understand closures if let Some(toggle_cursor_key) = global_state .settings .controls .get_binding(GameInput::ToggleCursor) + .filter(|_| !show_intro) { - if !self.show.intro { - match global_state.settings.interface.intro_show { - Intro::Show => { - if Button::image(self.imgs.button) - .w_h(150.0, 40.0) - .hover_image(self.imgs.button_hover) - .press_image(self.imgs.button_press) - .bottom_left_with_margins_on(ui_widgets.window, 200.0, 120.0) - .label(&i18n.get("hud.tutorial_btn")) - .label_font_id(self.fonts.cyri.conrod_id) - .label_font_size(self.fonts.cyri.scale(18)) - .label_color(TEXT_COLOR) - .label_y(conrod_core::position::Relative::Scalar(2.0)) - .image_color(ENEMY_HP_COLOR) - .set(self.ids.intro_button, ui_widgets) - .was_clicked() - { - self.show.intro = true; - self.show.want_grab = true; - } - Image::new(self.imgs.sp_indicator_arrow) - .w_h(20.0, 11.0) - .mid_top_with_margin_on(self.ids.intro_button, -20.0 + arrow_ani as f64) - .color(Some(QUALITY_LEGENDARY)) - .set(self.ids.tut_arrow, ui_widgets); - Text::new(&i18n.get("hud.tutorial_click_here").replace( - "{key}", - toggle_cursor_key.display_string(key_layout).as_str(), - )) - .mid_top_with_margin_on(self.ids.tut_arrow, -18.0) - .font_id(self.fonts.cyri.conrod_id) - .font_size(self.fonts.cyri.scale(14)) - .color(BLACK) - .set(self.ids.tut_arrow_txt_bg, ui_widgets); - Text::new(&i18n.get("hud.tutorial_click_here").replace( - "{key}", - toggle_cursor_key.display_string(key_layout).as_str(), - )) - .bottom_right_with_margins_on(self.ids.tut_arrow_txt_bg, 1.0, 1.0) - .font_id(self.fonts.cyri.conrod_id) - .font_size(self.fonts.cyri.scale(14)) - .color(QUALITY_LEGENDARY) - .set(self.ids.tut_arrow_txt, ui_widgets); - }, - Intro::Never => { - self.show.intro = false; - }, - } + prof_span!("temporary example quest"); + match global_state.settings.interface.intro_show { + Intro::Show => { + if Button::image(self.imgs.button) + .w_h(150.0, 40.0) + .hover_image(self.imgs.button_hover) + .press_image(self.imgs.button_press) + .bottom_left_with_margins_on(ui_widgets.window, 200.0, 120.0) + .label(&i18n.get("hud.tutorial_btn")) + .label_font_id(self.fonts.cyri.conrod_id) + .label_font_size(self.fonts.cyri.scale(18)) + .label_color(TEXT_COLOR) + .label_y(conrod_core::position::Relative::Scalar(2.0)) + .image_color(ENEMY_HP_COLOR) + .set(self.ids.intro_button, ui_widgets) + .was_clicked() + { + self.show.intro = true; + self.show.want_grab = true; + } + Image::new(self.imgs.sp_indicator_arrow) + .w_h(20.0, 11.0) + .mid_top_with_margin_on(self.ids.intro_button, -20.0 + arrow_ani as f64) + .color(Some(QUALITY_LEGENDARY)) + .set(self.ids.tut_arrow, ui_widgets); + Text::new(&i18n.get("hud.tutorial_click_here").replace( + "{key}", + toggle_cursor_key.display_string(key_layout).as_str(), + )) + .mid_top_with_margin_on(self.ids.tut_arrow, -18.0) + .font_id(self.fonts.cyri.conrod_id) + .font_size(self.fonts.cyri.scale(14)) + .color(BLACK) + .set(self.ids.tut_arrow_txt_bg, ui_widgets); + Text::new(&i18n.get("hud.tutorial_click_here").replace( + "{key}", + toggle_cursor_key.display_string(key_layout).as_str(), + )) + .bottom_right_with_margins_on(self.ids.tut_arrow_txt_bg, 1.0, 1.0) + .font_id(self.fonts.cyri.conrod_id) + .font_size(self.fonts.cyri.scale(14)) + .color(QUALITY_LEGENDARY) + .set(self.ids.tut_arrow_txt, ui_widgets); + }, + Intro::Never => { + self.show.intro = false; + }, } } // TODO: Add event/stat based tutorial system if self.show.intro && !self.show.esc_menu { + prof_span!("intro show"); match global_state.settings.interface.intro_show { Intro::Show => { if self.show.intro { @@ -2062,6 +2066,7 @@ impl Hud { // Display debug window. if let Some(debug_info) = debug_info { + prof_span!("debug info"); // Alpha Version Text::new(&version) .top_left_with_margins_on(ui_widgets.window, 5.0, 5.0) @@ -2281,6 +2286,7 @@ impl Hud { .set(self.ids.debug_info, ui_widgets); } } else { + prof_span!("help window"); // Help Window if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) { Text::new( diff --git a/voxygen/src/hud/popup.rs b/voxygen/src/hud/popup.rs index 78c44bc085..f1e8ef2f97 100644 --- a/voxygen/src/hud/popup.rs +++ b/voxygen/src/hud/popup.rs @@ -85,6 +85,7 @@ impl<'a> Widget for Popup<'a> { #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Popup::update"); let widget::UpdateArgs { state, ui, .. } = args; const FADE_IN: f32 = 0.5; diff --git a/voxygen/src/hud/prompt_dialog.rs b/voxygen/src/hud/prompt_dialog.rs index 409495d53d..eea312fb6b 100644 --- a/voxygen/src/hud/prompt_dialog.rs +++ b/voxygen/src/hud/prompt_dialog.rs @@ -83,6 +83,7 @@ impl<'a> Widget for PromptDialog<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("PromptDialog::update"); let widget::UpdateArgs { state, ui, .. } = args; let _localized_strings = &self.localized_strings; let mut event: Option = None; diff --git a/voxygen/src/hud/settings_window/chat.rs b/voxygen/src/hud/settings_window/chat.rs index 12b5f9b22f..3db6833f0d 100644 --- a/voxygen/src/hud/settings_window/chat.rs +++ b/voxygen/src/hud/settings_window/chat.rs @@ -122,6 +122,7 @@ impl<'a> Widget for Chat<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Chat::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/settings_window/controls.rs b/voxygen/src/hud/settings_window/controls.rs index 42daae7175..42fe82d28f 100644 --- a/voxygen/src/hud/settings_window/controls.rs +++ b/voxygen/src/hud/settings_window/controls.rs @@ -72,6 +72,7 @@ impl<'a> Widget for Controls<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Controls::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/settings_window/gameplay.rs b/voxygen/src/hud/settings_window/gameplay.rs index 5b08fac973..8797769007 100644 --- a/voxygen/src/hud/settings_window/gameplay.rs +++ b/voxygen/src/hud/settings_window/gameplay.rs @@ -98,6 +98,7 @@ impl<'a> Widget for Gameplay<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Gameplay::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/settings_window/interface.rs b/voxygen/src/hud/settings_window/interface.rs index 4a4c5cb32f..30478a2e20 100644 --- a/voxygen/src/hud/settings_window/interface.rs +++ b/voxygen/src/hud/settings_window/interface.rs @@ -137,6 +137,7 @@ impl<'a> Widget for Interface<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Interface::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/settings_window/language.rs b/voxygen/src/hud/settings_window/language.rs index 285a70df19..c317247d34 100644 --- a/voxygen/src/hud/settings_window/language.rs +++ b/voxygen/src/hud/settings_window/language.rs @@ -67,6 +67,7 @@ impl<'a> Widget for Language<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Language::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/settings_window/mod.rs b/voxygen/src/hud/settings_window/mod.rs index 8ef0a31c3e..874ae01bad 100644 --- a/voxygen/src/hud/settings_window/mod.rs +++ b/voxygen/src/hud/settings_window/mod.rs @@ -148,6 +148,7 @@ impl<'a> Widget for SettingsWindow<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("SettingsWindow::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/settings_window/sound.rs b/voxygen/src/hud/settings_window/sound.rs index eb3c4972e0..a60d0f5b15 100644 --- a/voxygen/src/hud/settings_window/sound.rs +++ b/voxygen/src/hud/settings_window/sound.rs @@ -80,6 +80,7 @@ impl<'a> Widget for Sound<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Sound::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/settings_window/video.rs b/voxygen/src/hud/settings_window/video.rs index 0ce0cc2b0e..d4b58bf0dd 100644 --- a/voxygen/src/hud/settings_window/video.rs +++ b/voxygen/src/hud/settings_window/video.rs @@ -177,6 +177,7 @@ impl<'a> Widget for Video<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Video::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); diff --git a/voxygen/src/hud/skillbar.rs b/voxygen/src/hud/skillbar.rs index f48eb11aa9..9956ab55d8 100644 --- a/voxygen/src/hud/skillbar.rs +++ b/voxygen/src/hud/skillbar.rs @@ -226,6 +226,7 @@ impl<'a> Widget for Skillbar<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Skillbar::update"); let widget::UpdateArgs { state, ui, .. } = args; let max_hp = self.health.base_max().max(self.health.maximum()); diff --git a/voxygen/src/hud/social.rs b/voxygen/src/hud/social.rs index 6e90ee40ee..2d428f3e60 100644 --- a/voxygen/src/hud/social.rs +++ b/voxygen/src/hud/social.rs @@ -109,6 +109,7 @@ impl<'a> Widget for Social<'a> { fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Social::update"); let widget::UpdateArgs { state, ui, .. } = args; let mut events = Vec::new(); let button_tooltip = Tooltip::new({ diff --git a/voxygen/src/hud/trade.rs b/voxygen/src/hud/trade.rs index 7dbdc061a7..3d48fdf92e 100644 --- a/voxygen/src/hud/trade.rs +++ b/voxygen/src/hud/trade.rs @@ -522,6 +522,7 @@ impl<'a> Widget for Trade<'a> { fn style(&self) -> Self::Style {} fn update(mut self, args: widget::UpdateArgs) -> Self::Event { + common_base::prof_span!("Trade::update"); let widget::UpdateArgs { mut state, ui, .. } = args; let mut event = None;