From 2511b8959ce1b40fe0c3d7d5f1cf2012687f880c Mon Sep 17 00:00:00 2001 From: Imbris Date: Sat, 13 Mar 2021 02:59:58 -0500 Subject: [PATCH] Add tracy entity count plot, span tweaks --- common/src/ray.rs | 2 -- server-cli/Cargo.toml | 2 +- server/Cargo.toml | 1 + server/src/lib.rs | 9 +++++++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/common/src/ray.rs b/common/src/ray.rs index 60eef65a05..2188658269 100644 --- a/common/src/ray.rs +++ b/common/src/ray.rs @@ -1,5 +1,4 @@ use crate::vol::ReadVol; -use common_base::span; use vek::*; pub trait RayForEach = FnMut(&V, Vec3); @@ -62,7 +61,6 @@ impl<'a, V: ReadVol, F: FnMut(&V::Vox) -> bool, G: RayForEach> Ray<'a, V } pub fn cast(mut self) -> (f32, Result, V::Error>) { - span!(_guard, "cast", "Ray::cast"); // TODO: Fully test this! const PLANCK: f32 = 0.001; diff --git a/server-cli/Cargo.toml b/server-cli/Cargo.toml index 4ea9b517f5..551295e18a 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [features] worldgen = ["server/worldgen"] default = ["worldgen"] -tracy = ["common/tracy", "tracing-tracy"] +tracy = ["common/tracy", "tracing-tracy", "server/tracy"] plugins = ["server/plugins"] [dependencies] diff --git a/server/Cargo.toml b/server/Cargo.toml index 4472f5ece3..91f08d0356 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -6,6 +6,7 @@ edition = "2018" [features] worldgen = [] +tracy = ["common/tracy"] simd = ["vek/platform_intrinsics"] plugins = ["common-sys/plugins"] diff --git a/server/src/lib.rs b/server/src/lib.rs index 51f4968f38..482a913c7b 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -702,6 +702,15 @@ impl Server { .set((end_of_server_tick - before_persistence_updates).as_nanos() as i64); } + #[cfg(feature = "tracy")] + { + use common_base::tracy_client::Plot; + use common_base::tracy_client::create_plot; + let entity_count = self.state.ecs().entities().join().count(); + static ENTITY_COUNT: Plot = create_plot!("entity count"); + ENTITY_COUNT.point(entity_count as f64); + } + // 9) Finish the tick, pass control back to the frontend. Ok(frontend_events)