From f39d1e9bb5015e5882f429fbae4f231249270828 Mon Sep 17 00:00:00 2001 From: Imbris Date: Mon, 7 Sep 2020 00:59:16 -0400 Subject: [PATCH] Use less verbose span names when the tracy feature is off --- common/src/clock.rs | 2 +- common/src/path.rs | 2 +- common/src/ray.rs | 2 +- common/src/region.rs | 2 +- common/src/sys/agent.rs | 2 +- common/src/sys/character_behavior.rs | 2 +- common/src/sys/combat.rs | 2 +- common/src/sys/controller.rs | 2 +- common/src/sys/mount.rs | 2 +- common/src/sys/phys.rs | 2 +- common/src/sys/projectile.rs | 2 +- common/src/sys/stats.rs | 2 +- common/src/util/mod.rs | 6 +++ server/src/events/mod.rs | 2 +- server/src/sys/entity_sync.rs | 2 +- server/src/sys/invite_timeout.rs | 2 +- server/src/sys/message.rs | 2 +- server/src/sys/object.rs | 2 +- server/src/sys/persistence.rs | 2 +- server/src/sys/sentinel.rs | 2 +- server/src/sys/subscription.rs | 2 +- server/src/sys/terrain.rs | 2 +- server/src/sys/terrain_sync.rs | 2 +- server/src/sys/waypoint.rs | 2 +- voxygen/src/hud/mod.rs | 6 +-- voxygen/src/menu/char_selection/mod.rs | 3 +- voxygen/src/menu/main/mod.rs | 3 +- voxygen/src/mesh/greedy.rs | 6 +-- voxygen/src/mesh/terrain.rs | 6 ++- voxygen/src/render/renderer.rs | 6 +-- voxygen/src/run.rs | 1 - voxygen/src/scene/camera.rs | 2 +- voxygen/src/scene/figure/mod.rs | 16 ++++---- voxygen/src/scene/mod.rs | 6 +-- voxygen/src/scene/particle.rs | 52 ++++++++++++++++++++------ voxygen/src/scene/terrain.rs | 10 ++--- voxygen/src/scene/terrain/watcher.rs | 2 +- voxygen/src/session.rs | 6 +-- voxygen/src/ui/mod.rs | 6 +-- voxygen/src/window.rs | 2 +- 40 files changed, 112 insertions(+), 73 deletions(-) diff --git a/common/src/clock.rs b/common/src/clock.rs index e819b5d17d..02d4946e5f 100644 --- a/common/src/clock.rs +++ b/common/src/clock.rs @@ -32,7 +32,7 @@ impl Clock { pub fn get_avg_delta(&self) -> Duration { Duration::from_secs_f64(self.running_tps_average) } pub fn tick(&mut self, tgt: Duration) { - span!(_guard, "Clock::tick"); + span!(_guard, "tick", "Clock::tick"); let delta = Instant::now().duration_since(self.last_sys_time); // Attempt to sleep to fill the gap. diff --git a/common/src/path.rs b/common/src/path.rs index cdad9bdbc9..f065f5f2db 100644 --- a/common/src/path.rs +++ b/common/src/path.rs @@ -328,7 +328,7 @@ impl Chaser { where V: BaseVol + ReadVol, { - span!(_guard, "Chaser::chase"); + span!(_guard, "chase", "Chaser::chase"); let pos_to_tgt = pos.distance(tgt); // If we're already close to the target then there's nothing to do diff --git a/common/src/ray.rs b/common/src/ray.rs index 91588e8d1f..7f58dc3926 100644 --- a/common/src/ray.rs +++ b/common/src/ray.rs @@ -55,7 +55,7 @@ impl<'a, V: ReadVol, F: RayUntil, G: RayForEach> Ray<'a, V, F, G } pub fn cast(mut self) -> (f32, Result, V::Error>) { - span!(_guard, "Ray::cast"); + span!(_guard, "cast", "Ray::cast"); // TODO: Fully test this! const PLANCK: f32 = 0.001; diff --git a/common/src/region.rs b/common/src/region.rs index 34ca7e2130..23428ba63b 100644 --- a/common/src/region.rs +++ b/common/src/region.rs @@ -107,7 +107,7 @@ impl RegionMap { // TODO maintain within a system? // TODO special case large entities pub fn tick(&mut self, pos: ReadStorage, vel: ReadStorage, entities: Entities) { - span!(_guard, "Region::tick"); + span!(_guard, "tick", "Region::tick"); self.tick += 1; // Clear events within each region for i in 0..self.regions.len() { diff --git a/common/src/sys/agent.rs b/common/src/sys/agent.rs index aa4b89e413..f6e7099e51 100644 --- a/common/src/sys/agent.rs +++ b/common/src/sys/agent.rs @@ -84,7 +84,7 @@ impl<'a> System<'a> for Sys { invites, ): Self::SystemData, ) { - span!(_guard, "agent::Sys::run"); + span!(_guard, "run", "agent::Sys::run"); for ( entity, pos, diff --git a/common/src/sys/character_behavior.rs b/common/src/sys/character_behavior.rs index d8865b2b89..d193bc6853 100644 --- a/common/src/sys/character_behavior.rs +++ b/common/src/sys/character_behavior.rs @@ -184,7 +184,7 @@ impl<'a> System<'a> for Sys { mountings, ): Self::SystemData, ) { - span!(_guard, "character_behavior::Sys::run"); + span!(_guard, "run", "character_behavior::Sys::run"); let mut server_emitter = server_bus.emitter(); let mut local_emitter = local_bus.emitter(); diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 770051ae02..12e485ec47 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -53,7 +53,7 @@ impl<'a> System<'a> for Sys { character_states, ): Self::SystemData, ) { - span!(_guard, "combat::Sys::run"); + span!(_guard, "run", "combat::Sys::run"); let mut server_emitter = server_bus.emitter(); let mut local_emitter = local_bus.emitter(); // Attacks diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index d24f5f0912..ba76d3c949 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -44,7 +44,7 @@ impl<'a> System<'a> for Sys { uids, ): Self::SystemData, ) { - span!(_guard, "controller::Sys::run"); + span!(_guard, "run", "controller::Sys::run"); let mut server_emitter = server_bus.emitter(); for (entity, _uid, controller, character_state) in diff --git a/common/src/sys/mount.rs b/common/src/sys/mount.rs index 9133743bac..a6fbfb8c9d 100644 --- a/common/src/sys/mount.rs +++ b/common/src/sys/mount.rs @@ -37,7 +37,7 @@ impl<'a> System<'a> for Sys { mut orientations, ): Self::SystemData, ) { - span!(_guard, "mount::Sys::run"); + span!(_guard, "run", "mount::Sys::run"); // Mounted entities. for (entity, mut mount_states) in (&entities, &mut mount_state.restrict_mut()).join() { match mount_states.get_unchecked() { diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index 405adea302..09b110fc46 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -95,7 +95,7 @@ impl<'a> System<'a> for Sys { projectiles, ): Self::SystemData, ) { - span!(_guard, "phys::Sys::run"); + span!(_guard, "run", "phys::Sys::run"); let mut event_emitter = event_bus.emitter(); // Add/reset physics state components diff --git a/common/src/sys/projectile.rs b/common/src/sys/projectile.rs index 35425df8a0..df4f4f1684 100644 --- a/common/src/sys/projectile.rs +++ b/common/src/sys/projectile.rs @@ -49,7 +49,7 @@ impl<'a> System<'a> for Sys { loadouts, ): Self::SystemData, ) { - span!(_guard, "projectile::Sys::run"); + span!(_guard, "run", "projectile::Sys::run"); let mut local_emitter = local_bus.emitter(); let mut server_emitter = server_bus.emitter(); diff --git a/common/src/sys/stats.rs b/common/src/sys/stats.rs index d262d0fc04..b35dc02e26 100644 --- a/common/src/sys/stats.rs +++ b/common/src/sys/stats.rs @@ -25,7 +25,7 @@ impl<'a> System<'a> for Sys { &mut self, (entities, dt, server_event_bus, character_states, mut stats, mut energies): Self::SystemData, ) { - span!(_guard, "stats::Sys::run"); + span!(_guard, "run", "stats::Sys::run"); let mut server_event_emitter = server_event_bus.emitter(); // Increment last change timer diff --git a/common/src/util/mod.rs b/common/src/util/mod.rs index bd9b18b91a..1c6940a201 100644 --- a/common/src/util/mod.rs +++ b/common/src/util/mod.rs @@ -40,6 +40,12 @@ macro_rules! span { 0, ); }; + ($guard_name:tt, $no_tracy_name:expr, $tracy_name:expr) => { + #[cfg(not(feature = "tracy"))] + $crate::span!($guard_name, $no_tracy_name); + #[cfg(feature = "tracy")] + $crate::span!($guard_name, $tracy_name); + }; } /// There's no guard, but really this is actually the guard diff --git a/server/src/events/mod.rs b/server/src/events/mod.rs index 5adaaec801..d56c4fa8c4 100644 --- a/server/src/events/mod.rs +++ b/server/src/events/mod.rs @@ -39,7 +39,7 @@ pub enum Event { impl Server { pub fn handle_events(&mut self) -> Vec { - span!(_guard, "Server::handle_events"); + span!(_guard, "handle_events", "Server::handle_events"); let mut frontend_events = Vec::new(); let mut requested_chunks = Vec::new(); diff --git a/server/src/sys/entity_sync.rs b/server/src/sys/entity_sync.rs index d3dc15b2ea..1dfd92e4aa 100644 --- a/server/src/sys/entity_sync.rs +++ b/server/src/sys/entity_sync.rs @@ -78,7 +78,7 @@ impl<'a> System<'a> for Sys { trackers, ): Self::SystemData, ) { - span!(_guard, "entity_sync::Sys::run"); + span!(_guard, "run", "entity_sync::Sys::run"); timer.start(); let tick = tick.0; diff --git a/server/src/sys/invite_timeout.rs b/server/src/sys/invite_timeout.rs index 8c725d976e..834f812a84 100644 --- a/server/src/sys/invite_timeout.rs +++ b/server/src/sys/invite_timeout.rs @@ -25,7 +25,7 @@ impl<'a> System<'a> for Sys { &mut self, (entities, mut invites, mut pending_invites, mut clients, uids, mut timer): Self::SystemData, ) { - span!(_guard, "invite_timeout::Sys::run"); + span!(_guard, "run", "invite_timeout::Sys::run"); timer.start(); let now = std::time::Instant::now(); diff --git a/server/src/sys/message.rs b/server/src/sys/message.rs index c61ad7dc5a..31fa9dffbf 100644 --- a/server/src/sys/message.rs +++ b/server/src/sys/message.rs @@ -455,7 +455,7 @@ impl<'a> System<'a> for Sys { alias_validator, ): Self::SystemData, ) { - span!(_guard, "message::Sys::run"); + span!(_guard, "run", "message::Sys::run"); timer.start(); let mut server_emitter = server_event_bus.emitter(); diff --git a/server/src/sys/object.rs b/server/src/sys/object.rs index f044c198fc..d6deafad3e 100644 --- a/server/src/sys/object.rs +++ b/server/src/sys/object.rs @@ -24,7 +24,7 @@ impl<'a> System<'a> for Sys { &mut self, (entities, _dt, server_bus, positions, velocities, physics_states, mut objects): Self::SystemData, ) { - span!(_guard, "object::Sys::run"); + span!(_guard, "run", "object::Sys::run"); let mut server_emitter = server_bus.emitter(); // Objects diff --git a/server/src/sys/persistence.rs b/server/src/sys/persistence.rs index 444754b79c..c1dd0982b4 100644 --- a/server/src/sys/persistence.rs +++ b/server/src/sys/persistence.rs @@ -34,7 +34,7 @@ impl<'a> System<'a> for Sys { mut timer, ): Self::SystemData, ) { - span!(_guard, "persistence::Sys::run"); + span!(_guard, "run", "persistence::Sys::run"); if scheduler.should_run() { timer.start(); updater.batch_update( diff --git a/server/src/sys/sentinel.rs b/server/src/sys/sentinel.rs index 8f67f2d03c..5fb64ddd5f 100644 --- a/server/src/sys/sentinel.rs +++ b/server/src/sys/sentinel.rs @@ -27,7 +27,7 @@ impl<'a> System<'a> for Sys { ); fn run(&mut self, (mut timer, comps, mut trackers): Self::SystemData) { - span!(_guard, "sentinel::Sys::run"); + span!(_guard, "run", "sentinel::Sys::run"); timer.start(); record_changes(&comps, &mut trackers); diff --git a/server/src/sys/subscription.rs b/server/src/sys/subscription.rs index a29243df18..1e0df762bd 100644 --- a/server/src/sys/subscription.rs +++ b/server/src/sys/subscription.rs @@ -56,7 +56,7 @@ impl<'a> System<'a> for Sys { tracked_comps, ): Self::SystemData, ) { - span!(_guard, "subscription::Sys::run"); + span!(_guard, "run", "subscription::Sys::run"); timer.start(); // To update subscriptions diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index dc8b77347b..ace7d43814 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -56,7 +56,7 @@ impl<'a> System<'a> for Sys { mut clients, ): Self::SystemData, ) { - span!(_guard, "terrain::Sys::run"); + span!(_guard, "run", "terrain::Sys::run"); timer.start(); let mut server_emitter = server_event_bus.emitter(); diff --git a/server/src/sys/terrain_sync.rs b/server/src/sys/terrain_sync.rs index 1398a2b1af..8d0e8b5f23 100644 --- a/server/src/sys/terrain_sync.rs +++ b/server/src/sys/terrain_sync.rs @@ -27,7 +27,7 @@ impl<'a> System<'a> for Sys { &mut self, (terrain, terrain_changes, mut timer, positions, players, mut clients): Self::SystemData, ) { - span!(_guard, "terrain_sync::Sys::run"); + span!(_guard, "run", "terrain_sync::Sys::run"); timer.start(); // Sync changed chunks diff --git a/server/src/sys/waypoint.rs b/server/src/sys/waypoint.rs index 870dacf8ab..d9b0f0e739 100644 --- a/server/src/sys/waypoint.rs +++ b/server/src/sys/waypoint.rs @@ -31,7 +31,7 @@ impl<'a> System<'a> for Sys { &mut self, (entities, positions, players, waypoint_areas, mut waypoints, mut clients, time, mut timer): Self::SystemData, ) { - span!(_guard, "waypoint::Sys::run"); + span!(_guard, "run", "waypoint::Sys::run"); timer.start(); for (entity, player_pos, _, client) in diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 9d1ecb5369..f6202d87d5 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -688,7 +688,7 @@ impl Hud { info: HudInfo, camera: &Camera, ) -> Vec { - span!(_guard, "Hud::update_layout"); + span!(_guard, "update_layout", "Hud::update_layout"); let mut events = std::mem::replace(&mut self.events, Vec::new()); let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets(); // pulse time for pulsating elements @@ -2533,7 +2533,7 @@ impl Hud { dt: Duration, info: HudInfo, ) -> Vec { - span!(_guard, "Hud::maintain"); + span!(_guard, "maintain", "Hud::maintain"); // conrod eats tabs. Un-eat a tabstop so tab completion can work if self.ui.ui.global_input().events().any(|event| { use conrod_core::{event, input}; @@ -2578,7 +2578,7 @@ impl Hud { } pub fn render(&self, renderer: &mut Renderer, globals: &Consts) { - span!(_guard, "Hud::render"); + span!(_guard, "render", "Hud::render"); // Don't show anything if the UI is toggled off. if self.show.ui { self.ui.render(renderer, Some(globals)); diff --git a/voxygen/src/menu/char_selection/mod.rs b/voxygen/src/menu/char_selection/mod.rs index e405f78b8d..6846bbdf92 100644 --- a/voxygen/src/menu/char_selection/mod.rs +++ b/voxygen/src/menu/char_selection/mod.rs @@ -10,7 +10,7 @@ use crate::{ Direction, GlobalState, PlayState, PlayStateResult, }; use client::{self, Client}; -use common::{assets::Asset, comp, msg::ClientState, state::DeltaTime}; +use common::{assets::Asset, comp, msg::ClientState, span, state::DeltaTime}; use specs::WorldExt; use std::{cell::RefCell, rc::Rc}; use tracing::error; @@ -60,6 +60,7 @@ impl PlayState for CharSelectionState { } fn tick(&mut self, global_state: &mut GlobalState, events: Vec) -> PlayStateResult { + span!(_guard, "tick", "::tick"); let client_state = self.client.borrow().get_client_state(); if let ClientState::Pending | ClientState::Registered = client_state { // Handle window events diff --git a/voxygen/src/menu/main/mod.rs b/voxygen/src/menu/main/mod.rs index bbc11c846e..8f65cc0c12 100644 --- a/voxygen/src/menu/main/mod.rs +++ b/voxygen/src/menu/main/mod.rs @@ -9,7 +9,7 @@ use crate::{ PlayStateResult, }; use client_init::{ClientInit, Error as InitError, Msg as InitMsg}; -use common::{assets::Asset, comp}; +use common::{assets::Asset, comp, span}; use tracing::{error, warn}; use ui::{Event as MainMenuEvent, MainMenuUi}; @@ -46,6 +46,7 @@ impl PlayState for MainMenuState { } fn tick(&mut self, global_state: &mut GlobalState, events: Vec) -> PlayStateResult { + span!(_guard, "tick", "::tick"); let localized_strings = crate::i18n::VoxygenLocalization::load_expect( &crate::i18n::i18n_asset_key(&global_state.settings.language.selected_language), ); diff --git a/voxygen/src/mesh/greedy.rs b/voxygen/src/mesh/greedy.rs index cfd8d4b143..13e70b639c 100644 --- a/voxygen/src/mesh/greedy.rs +++ b/voxygen/src/mesh/greedy.rs @@ -102,7 +102,7 @@ impl<'a> GreedyMesh<'a> { /// most 30 bits total, meaning we are restricted to "only" at most 2^15 /// × 2^15 atlases even if the hardware supports larger ones. pub fn new(max_size: guillotiere::Size) -> Self { - span!(_guard, "GreedyMesh::new"); + span!(_guard, "new", "GreedyMesh::new"); let min_max_dim = max_size.width.min(max_size.height); assert!( min_max_dim >= 4, @@ -150,7 +150,7 @@ impl<'a> GreedyMesh<'a> { FS: for<'r> FnMut(&'r mut D, Vec3, Vec3, Vec2>) -> Option<(bool, M)>, FP: FnMut(Vec2, Vec2>, Vec3, Vec2>, Vec3, &M), { - span!(_guard, "GreedyMesh::push"); + span!(_guard, "push", "GreedyMesh::push"); let cont = greedy_mesh( &mut self.atlas, &mut self.col_lights_size, @@ -170,7 +170,7 @@ impl<'a> GreedyMesh<'a> { /// /// Returns the ColLightsInfo corresponding to the constructed atlas. pub fn finalize(self) -> ColLightInfo { - span!(_guard, "GreedyMesh::finalize"); + span!(_guard, "finalize", "GreedyMesh::finalize"); let cur_size = self.col_lights_size; let col_lights = vec![ TerrainVertex::make_col_light(254, Rgb::broadcast(254)); diff --git a/voxygen/src/mesh/terrain.rs b/voxygen/src/mesh/terrain.rs index c9242df5a1..05725ff629 100644 --- a/voxygen/src/mesh/terrain.rs +++ b/voxygen/src/mesh/terrain.rs @@ -242,7 +242,11 @@ impl<'a, V: RectRasterableVol + ReadVol + Debug> self, (range, max_texture_size): Self::Supplement, ) -> MeshGen { - span!(_guard, "<&VolGrid2d as Meshable<_, _>>::generate_mesh"); + span!( + _guard, + "generate_mesh", + "<&VolGrid2d as Meshable<_, _>>::generate_mesh" + ); // Find blocks that should glow // FIXME: Replace with real lit blocks when we actually have blocks that glow. let lit_blocks = core::iter::empty(); diff --git a/voxygen/src/render/renderer.rs b/voxygen/src/render/renderer.rs index eb3246cc3e..96b43753cf 100644 --- a/voxygen/src/render/renderer.rs +++ b/voxygen/src/render/renderer.rs @@ -606,7 +606,7 @@ impl Renderer { /// Queue the clearing of the shadow targets ready for a new frame to be /// rendered. pub fn clear_shadows(&mut self) { - span!(_guard, "Renderer::clear_shadows"); + span!(_guard, "clear_shadows", "Renderer::clear_shadows"); if !self.mode.shadow.is_map() { return; } @@ -679,7 +679,7 @@ impl Renderer { /// Queue the clearing of the depth target ready for a new frame to be /// rendered. pub fn clear(&mut self) { - span!(_guard, "Renderer::clear"); + span!(_guard, "clear", "Renderer::clear"); self.encoder.clear_depth(&self.tgt_depth_stencil_view, 1.0); // self.encoder.clear_stencil(&self.tgt_depth_stencil_view, 0); self.encoder.clear_depth(&self.win_depth_view, 1.0); @@ -715,7 +715,7 @@ impl Renderer { /// Perform all queued draw calls for this frame and clean up discarded /// items. pub fn flush(&mut self) { - span!(_guard, "Renderer::flush"); + span!(_guard, "flush", "Renderer::flush"); self.encoder.flush(&mut self.device); self.device.cleanup(); diff --git a/voxygen/src/run.rs b/voxygen/src/run.rs index 1d22384c6e..ee9004fa1d 100644 --- a/voxygen/src/run.rs +++ b/voxygen/src/run.rs @@ -92,7 +92,6 @@ fn handle_main_events_cleared( let mut exit = true; while let Some(state_result) = states.last_mut().map(|last| { let events = global_state.window.fetch_events(); - span!(_guard, "PlayState::tick"); last.tick(global_state, events) }) { // Implement state transfer logic. diff --git a/voxygen/src/scene/camera.rs b/voxygen/src/scene/camera.rs index d5b747efd9..f48db8a7f3 100644 --- a/voxygen/src/scene/camera.rs +++ b/voxygen/src/scene/camera.rs @@ -81,7 +81,7 @@ impl Camera { /// Compute the transformation matrices (view matrix and projection matrix) /// and position of the camera. pub fn compute_dependents(&mut self, terrain: &impl ReadVol) { - span!(_guard, "Camera::compute_dependents"); + span!(_guard, "compute_dependents", "Camera::compute_dependents"); let dist = { let (start, end) = (self.focus - self.forward() * self.dist, self.focus); diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 1480262b81..15e14f6998 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -196,7 +196,7 @@ impl FigureMgrStates { } fn retain(&mut self, mut f: impl FnMut(&EcsEntity, &mut FigureStateMeta) -> bool) { - span!(_guard, "FigureManagerStates::retain"); + span!(_guard, "retain", "FigureManagerStates::retain"); self.character_states.retain(|k, v| f(k, &mut *v)); self.quadruped_small_states.retain(|k, v| f(k, &mut *v)); self.quadruped_medium_states.retain(|k, v| f(k, &mut *v)); @@ -339,7 +339,7 @@ impl FigureMgr { pub fn col_lights(&self) -> &FigureColLights { &self.col_lights } pub fn clean(&mut self, tick: u64) { - span!(_guard, "FigureManager::clean"); + span!(_guard, "clean", "FigureManager::clean"); self.model_cache.clean(&mut self.col_lights, tick); self.critter_model_cache.clean(&mut self.col_lights, tick); self.quadruped_small_model_cache @@ -366,7 +366,7 @@ impl FigureMgr { #[allow(clippy::redundant_pattern_matching)] // TODO: Pending review in #587 pub fn update_lighting(&mut self, scene_data: &SceneData) { - span!(_guard, "FigureManager::update_lighting"); + span!(_guard, "update_lighting", "FigureManager::update_lighting"); let ecs = scene_data.state.ecs(); for (entity, body, light_emitter) in ( &ecs.entities(), @@ -455,7 +455,7 @@ impl FigureMgr { visible_psr_bounds: math::Aabr, camera: &Camera, ) -> anim::vek::Aabb { - span!(_guard, "FigureManager::maintain"); + span!(_guard, "maintain", "FigureManager::maintain"); let state = scene_data.state; let time = state.get_time(); let tick = scene_data.tick; @@ -2135,7 +2135,7 @@ impl FigureMgr { (is_daylight, _light_data): super::LightData, (camera, figure_lod_render_distance): CameraData, ) { - span!(_guard, "FigureManager::render_shadows"); + span!(_guard, "render_shadows", "FigureManager::render_shadows"); let ecs = state.ecs(); if is_daylight && renderer.render_mode().shadow.is_map() { @@ -2187,7 +2187,7 @@ impl FigureMgr { lod: &LodData, (camera, figure_lod_render_distance): CameraData, ) { - span!(_guard, "FigureManager::render"); + span!(_guard, "render", "FigureManager::render"); let ecs = state.ecs(); let character_state_storage = state.read_storage::(); @@ -2238,7 +2238,7 @@ impl FigureMgr { lod: &LodData, (camera, figure_lod_render_distance): CameraData, ) { - span!(_guard, "FigureManager::render_player"); + span!(_guard, "render_player", "FigureManager::render_player"); let ecs = state.ecs(); let character_state_storage = state.read_storage::(); @@ -2622,7 +2622,7 @@ impl FigureColLights { (opaque, bounds): (Mesh, math::Aabb), vertex_range: [Range; N], ) -> Result, RenderError> { - span!(_guard, "FigureColLights::create_figure"); + span!(_guard, "create_figure", "FigureColLights::create_figure"); let atlas = &mut self.atlas; let allocation = atlas .allocate(guillotiere::Size::new( diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index dceac65b85..537ed1c5d6 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -380,7 +380,7 @@ impl Scene { scene_data: &SceneData, audio: &mut AudioFrontend, ) { - span!(_guard, "Scene::handle_outcome"); + span!(_guard, "handle_outcome", "Scene::handle_outcome"); self.particle_mgr.handle_outcome(&outcome, &scene_data); self.sfx_mgr.handle_outcome(&outcome, audio); @@ -424,7 +424,7 @@ impl Scene { audio: &mut AudioFrontend, scene_data: &SceneData, ) { - span!(_guard, "Scene::maintain"); + span!(_guard, "maintain", "Scene::maintain"); // Get player position. let ecs = scene_data.state.ecs(); @@ -976,7 +976,7 @@ impl Scene { tick: u64, scene_data: &SceneData, ) { - span!(_guard, "Scene::render"); + span!(_guard, "render", "Scene::render"); let sun_dir = scene_data.get_sun_dir(); let is_daylight = sun_dir.z < 0.0; let focus_pos = self.camera.get_focus_pos(); diff --git a/voxygen/src/scene/particle.rs b/voxygen/src/scene/particle.rs index 4ec3df2161..127530d541 100644 --- a/voxygen/src/scene/particle.rs +++ b/voxygen/src/scene/particle.rs @@ -49,7 +49,7 @@ impl ParticleMgr { } pub fn handle_outcome(&mut self, outcome: &Outcome, scene_data: &SceneData) { - span!(_guard, "ParticleMgr::handle_outcome"); + span!(_guard, "handle_outcome", "ParticleMgr::handle_outcome"); let time = scene_data.state.get_time(); let mut rng = rand::thread_rng(); @@ -100,7 +100,7 @@ impl ParticleMgr { scene_data: &SceneData, terrain: &Terrain, ) { - span!(_guard, "ParticleMgr::maintain"); + span!(_guard, "maintain", "ParticleMgr::maintain"); if scene_data.particles_enabled { // update timings self.scheduler.maintain(scene_data.state.get_time()); @@ -125,7 +125,11 @@ impl ParticleMgr { } fn maintain_body_particles(&mut self, scene_data: &SceneData) { - span!(_guard, "ParticleMgr::maintain_body_particles"); + span!( + _guard, + "body_particles", + "ParticleMgr::maintain_body_particles" + ); let ecs = scene_data.state.ecs(); for (body, pos) in (&ecs.read_storage::(), &ecs.read_storage::()).join() { match body { @@ -152,7 +156,11 @@ impl ParticleMgr { } fn maintain_campfirelit_particles(&mut self, scene_data: &SceneData, pos: &Pos) { - span!(_guard, "ParticleMgr::maintain_campfirelit_particles"); + span!( + _guard, + "campfirelit_particles", + "ParticleMgr::maintain_campfirelit_particles" + ); let time = scene_data.state.get_time(); for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) { @@ -173,7 +181,11 @@ impl ParticleMgr { } fn maintain_boltfire_particles(&mut self, scene_data: &SceneData, pos: &Pos) { - span!(_guard, "ParticleMgr::maintain_boltfire_particles"); + span!( + _guard, + "boltfire_particles", + "ParticleMgr::maintain_boltfire_particles" + ); let time = scene_data.state.get_time(); for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) { @@ -193,7 +205,11 @@ impl ParticleMgr { } fn maintain_boltfirebig_particles(&mut self, scene_data: &SceneData, pos: &Pos) { - span!(_guard, "ParticleMgr::maintain_boltfirebig_particles"); + span!( + _guard, + "boltfirebig_particles", + "ParticleMgr::maintain_boltfirebig_particles" + ); let time = scene_data.state.get_time(); // fire @@ -224,7 +240,11 @@ impl ParticleMgr { } fn maintain_bomb_particles(&mut self, scene_data: &SceneData, pos: &Pos) { - span!(_guard, "ParticleMgr::maintain_bomb_particles"); + span!( + _guard, + "bomb_particles", + "ParticleMgr::maintain_bomb_particles" + ); let time = scene_data.state.get_time(); for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) { @@ -247,7 +267,11 @@ impl ParticleMgr { } fn maintain_boost_particles(&mut self, scene_data: &SceneData) { - span!(_guard, "ParticleMgr::maintain_boost_particles"); + span!( + _guard, + "boost_particles", + "ParticleMgr::maintain_boost_particles" + ); let state = scene_data.state; let ecs = state.ecs(); let time = state.get_time(); @@ -281,7 +305,11 @@ impl ParticleMgr { scene_data: &SceneData, terrain: &Terrain, ) { - span!(_guard, "ParticleMgr::maintain_block_particles"); + span!( + _guard, + "block_particles", + "ParticleMgr::maintain_block_particles" + ); let dt = scene_data.state.ecs().fetch::().0; let time = scene_data.state.get_time(); let player_pos = scene_data @@ -393,7 +421,7 @@ impl ParticleMgr { } fn upload_particles(&mut self, renderer: &mut Renderer) { - span!(_guard, "ParticleMgr::upload_particles"); + span!(_guard, "upload_particles", "ParticleMgr::upload_particles"); let all_cpu_instances = self .particles .iter() @@ -415,7 +443,7 @@ impl ParticleMgr { global: &GlobalModel, lod: &LodData, ) { - span!(_guard, "ParticleMgr::render"); + span!(_guard, "render", "ParticleMgr::render"); if scene_data.particles_enabled { let model = &self .model_cache @@ -501,7 +529,7 @@ impl HeartbeatScheduler { /// updates the last elapsed times and elapsed counts /// this should be called once, and only once per tick. pub fn maintain(&mut self, now: f64) { - span!(_guard, "HeartbeatScheduler::maintain"); + span!(_guard, "maintain", "HeartbeatScheduler::maintain"); self.last_known_time = now; for (frequency, (last_update, heartbeats)) in self.timers.iter_mut() { diff --git a/voxygen/src/scene/terrain.rs b/voxygen/src/scene/terrain.rs index 8449ce7e3c..9530f78a8f 100644 --- a/voxygen/src/scene/terrain.rs +++ b/voxygen/src/scene/terrain.rs @@ -385,7 +385,7 @@ impl Terrain { fn make_atlas( renderer: &mut Renderer, ) -> Result<(AtlasAllocator, Texture), RenderError> { - span!(_guard, "Terrain::make_atlas"); + span!(_guard, "male_atlas", "Terrain::make_atlas"); let max_texture_size = renderer.max_texture_size(); let atlas_size = guillotiere::Size::new(i32::from(max_texture_size), i32::from(max_texture_size)); @@ -453,7 +453,7 @@ impl Terrain { view_mat: Mat4, proj_mat: Mat4, ) -> (Aabb, Vec>, math::Aabr) { - span!(_guard, "Terrain::maintain"); + span!(_guard, "maintain", "Terrain::maintain"); let current_tick = scene_data.tick; let current_time = scene_data.state.get_time(); let mut visible_bounding_box: Option> = None; @@ -951,7 +951,7 @@ impl Terrain { (is_daylight, light_data): super::LightData, focus_pos: Vec3, ) { - span!(_guard, "Terrain::render_shadows"); + span!(_guard, "render_shadows", "Terrain::render_shadows"); if !renderer.render_mode().shadow.is_map() { return; }; @@ -1013,7 +1013,7 @@ impl Terrain { lod: &LodData, focus_pos: Vec3, ) { - span!(_guard, "Terrain::render"); + span!(_guard, "render", "Terrain::render"); let focus_chunk = Vec2::from(focus_pos).map2(TerrainChunk::RECT_SIZE, |e: f32, sz| { (e as i32).div_euclid(sz as i32) }); @@ -1047,7 +1047,7 @@ impl Terrain { cam_pos: Vec3, sprite_render_distance: f32, ) { - span!(_guard, "Terrain::render_translucent"); + span!(_guard, "render_translucent", "Terrain::render_translucent"); let focus_chunk = Vec2::from(focus_pos).map2(TerrainChunk::RECT_SIZE, |e: f32, sz| { (e as i32).div_euclid(sz as i32) }); diff --git a/voxygen/src/scene/terrain/watcher.rs b/voxygen/src/scene/terrain/watcher.rs index 981d95a9a1..4e1fed21d9 100644 --- a/voxygen/src/scene/terrain/watcher.rs +++ b/voxygen/src/scene/terrain/watcher.rs @@ -17,7 +17,7 @@ pub struct BlocksOfInterest { impl BlocksOfInterest { pub fn from_chunk(chunk: &TerrainChunk) -> Self { - span!(_guard, "BlocksOfInterest::from_chunk"); + span!(_guard, "from_chunk", "BlocksOfInterest::from_chunk"); let mut leaves = Vec::new(); let mut grass = Vec::new(); let mut embers = Vec::new(); diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index 40edad0338..259e526dd9 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -112,7 +112,7 @@ impl SessionState { global_state: &mut GlobalState, outcomes: &mut Vec, ) -> Result { - span!(_guard, "Session::tick"); + span!(_guard, "tick", "Session::tick"); self.inputs.tick(dt); let mut client = self.client.borrow_mut(); @@ -197,7 +197,7 @@ impl PlayState for SessionState { } fn tick(&mut self, global_state: &mut GlobalState, events: Vec) -> PlayStateResult { - span!(_guard, "::tick"); + span!(_guard, "tick", "::tick"); // NOTE: Not strictly necessary, but useful for hotloading translation changes. self.voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key( &global_state.settings.language.selected_language, @@ -1116,7 +1116,7 @@ impl PlayState for SessionState { /// /// This method should be called once per frame. fn render(&mut self, renderer: &mut Renderer, settings: &Settings) { - span!(_guard, "::render"); + span!(_guard, "render", "::render"); // Render the screen using the global renderer { let client = self.client.borrow(); diff --git a/voxygen/src/ui/mod.rs b/voxygen/src/ui/mod.rs index b63956a72b..cc9f6ca2b2 100644 --- a/voxygen/src/ui/mod.rs +++ b/voxygen/src/ui/mod.rs @@ -292,7 +292,7 @@ impl Ui { #[allow(clippy::float_cmp)] // TODO: Pending review in #587 pub fn maintain(&mut self, renderer: &mut Renderer, view_projection_mat: Option>) { - span!(_guard, "Ui::maintain"); + span!(_guard, "maintain", "Ui::maintain"); // Maintain tooltip manager self.tooltip_manager .maintain(self.ui.global_input(), self.scale.scale_factor_logical()); @@ -334,7 +334,7 @@ impl Ui { view_projection_mat: Option>, retry: &mut bool, ) { - span!(_guard, "Ui::maintain_internal"); + span!(_guard, "internal", "Ui::maintain_internal"); let (graphic_cache, text_cache, glyph_cache, cache_tex) = self.cache.cache_mut_and_tex(); let mut primitives = if *retry { @@ -979,7 +979,7 @@ impl Ui { } pub fn render(&self, renderer: &mut Renderer, maybe_globals: Option<&Consts>) { - span!(_guard, "Ui::render"); + span!(_guard, "render", "Ui::render"); let mut scissor = default_scissor(renderer); let globals = maybe_globals.unwrap_or(&self.default_globals); let mut locals = &self.interface_locals; diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index 1adc1a1a13..bfec6aa8c7 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -1049,7 +1049,7 @@ impl Window { } pub fn swap_buffers(&self) -> Result<(), Error> { - span!(_guard, "Window::swap_buffers"); + span!(_guard, "swap_buffers", "Window::swap_buffers"); self.window .swap_buffers() .map_err(|err| Error::BackendError(Box::new(err)))