diff --git a/client/src/lib.rs b/client/src/lib.rs index aa598febc6..9d24b84102 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1797,6 +1797,7 @@ impl Client { add_foreign_systems(dispatch_builder); }, true, + None, ); // TODO: avoid emitting these in the first place let _ = self diff --git a/common/base/src/lib.rs b/common/base/src/lib.rs index 098d881849..6e9b2771a7 100644 --- a/common/base/src/lib.rs +++ b/common/base/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(fundamental)] - pub mod userdata_dir; pub use userdata_dir::userdata_dir; diff --git a/common/state/src/state.rs b/common/state/src/state.rs index 39c276d01e..00d8aa66e9 100644 --- a/common/state/src/state.rs +++ b/common/state/src/state.rs @@ -35,7 +35,7 @@ use specs::{ storage::{MaskedStorage as EcsMaskedStorage, Storage as EcsStorage}, Component, DispatcherBuilder, Entity as EcsEntity, WorldExt, }; -use std::sync::Arc; +use std::{sync::Arc, time::Instant}; use timer_queue::TimerQueue; use vek::*; @@ -596,8 +596,19 @@ impl State { dt: Duration, add_systems: impl Fn(&mut DispatcherBuilder), update_terrain_and_regions: bool, + mut metrics: Option<&mut StateTickMetrics>, ) { span!(_guard, "tick", "State::tick"); + + // Timing code for server metrics + macro_rules! section_span { + ($guard:ident, $label:literal) => { + span!(span_guard, $label); + let metrics_guard = metrics.as_mut().map(|m| MetricsGuard::new($label, m)); + let $guard = (span_guard, metrics_guard); + }; + } + // Change the time accordingly. self.ecs.write_resource::().0 += dt.as_secs_f64() * DAY_CYCLE_FACTOR; self.ecs.write_resource::