From 0683a40741e13c8688824440887f76b5dd227692 Mon Sep 17 00:00:00 2001 From: Imbris Date: Sat, 29 Aug 2020 03:00:26 -0400 Subject: [PATCH] Use finish_continuous_frame directly --- .cargo/config | 2 ++ Cargo.lock | 1 - common/src/util/mod.rs | 2 ++ server-cli/src/main.rs | 11 +++++++---- server/src/sys/message.rs | 2 +- voxygen/Cargo.toml | 3 +-- voxygen/src/run.rs | 3 ++- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.cargo/config b/.cargo/config index 6184721f7e..d07f71d5cc 100644 --- a/.cargo/config +++ b/.cargo/config @@ -6,6 +6,8 @@ rustflags = [ [alias] generate = "run --package tools --" test-server = "-Zpackage-features run --bin veloren-server-cli --no-default-features" +tracy-server = "-Zunstable-options -Zpackage-features run --bin veloren-server-cli --no-default-features --features tracy --profile no_overflow" test-voxygen = "-Zpackage-features run --bin veloren-voxygen --no-default-features --features gl" +tracy-voxygen = "-Zunstable-options -Zpackage-features run --bin veloren-voxygen --no-default-features --features tracy gl --profile no_overflow" server = "run --bin veloren-server-cli" diff --git a/Cargo.lock b/Cargo.lock index cf7c15526c..ff7699bcc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5040,7 +5040,6 @@ dependencies = [ "tracing-log", "tracing-subscriber", "tracing-tracy", - "tracy-client", "treeculler", "uvth 3.1.1", "vek 0.12.0", diff --git a/common/src/util/mod.rs b/common/src/util/mod.rs index c17e88f832..a3ca02bc19 100644 --- a/common/src/util/mod.rs +++ b/common/src/util/mod.rs @@ -11,6 +11,8 @@ lazy_static::lazy_static! { pub use color::*; pub use dir::*; +#[cfg(feature = "tracy")] pub use tracy_client; + // https://discordapp.com/channels/676678179678715904/676685797524766720/723358438943621151 #[macro_export] macro_rules! span { diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index e111f645b7..0b03d3913a 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -12,9 +12,9 @@ use crate::{ use common::clock::Clock; use server::{Event, Input, Server, ServerSettings}; use tracing::{info, Level}; -use tracing_subscriber::{ - filter::LevelFilter, layer::SubscriberExt, prelude::*, EnvFilter, FmtSubscriber, -}; +use tracing_subscriber::{filter::LevelFilter, EnvFilter, FmtSubscriber}; +#[cfg(feature = "tracy")] +use tracing_subscriber::{layer::SubscriberExt, prelude::*}; use clap::{App, Arg}; use std::{io, sync::mpsc, time::Duration}; @@ -77,6 +77,8 @@ fn main() -> io::Result<()> { .init(); #[cfg(not(feature = "tracy"))] + // TODO: when tracing gets per Layer filters re-enable this when the tracy feature is being + // used (and do the same in voxygen) { let subscriber = FmtSubscriber::builder() .with_max_level(Level::ERROR) @@ -122,7 +124,8 @@ fn main() -> io::Result<()> { // Clean up the server after a tick. server.cleanup(); - tracing::trace!(tracy.frame_mark = true); + #[cfg(feature = "tracy")] + common::util::tracy_client::finish_continuous_frame!(); match msg_r.try_recv() { Ok(msg) => match msg { diff --git a/server/src/sys/message.rs b/server/src/sys/message.rs index a25c23f622..c61ad7dc5a 100644 --- a/server/src/sys/message.rs +++ b/server/src/sys/message.rs @@ -4,7 +4,6 @@ use crate::{ persistence::character::CharacterLoader, ServerSettings, }; use common::{ - span, comp::{ Admin, AdminList, CanBuild, ChatMode, ChatType, ControlEvent, Controller, ForceUpdate, Ori, Player, Pos, Stats, UnresolvedChatMsg, Vel, @@ -14,6 +13,7 @@ use common::{ validate_chat_msg, CharacterInfo, ChatMsgValidationError, ClientMsg, ClientState, PlayerInfo, PlayerListUpdate, RequestStateError, ServerMsg, MAX_BYTES_CHAT_MSG, }, + span, state::{BlockChange, Time}, sync::Uid, terrain::{Block, TerrainChunkSize, TerrainGrid}, diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index b2764f4910..ced96e496d 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -12,7 +12,7 @@ version = "0.7.0" gl = ["gfx_device_gl", "gfx_gl"] hot-anim = ["anim/use-dyn-lib"] singleplayer = ["server"] -tracy = ["tracing-tracy", "tracy-client", "common/tracy"] +tracy = ["tracing-tracy", "common/tracy"] tweak = ["const-tweaker"] default = ["gl", "singleplayer", "msgbox"] @@ -84,7 +84,6 @@ tracing-subscriber = {version = "0.2.3", default-features = false, features = [" # Tracy tracing-tracy = { version = "0.2.0", optional = true } -tracy-client = { version = "0.8.0", optional = true } [target.'cfg(target_os = "macos")'.dependencies] dispatch = "0.1.4" diff --git a/voxygen/src/run.rs b/voxygen/src/run.rs index c21af359bd..1d22384c6e 100644 --- a/voxygen/src/run.rs +++ b/voxygen/src/run.rs @@ -162,7 +162,8 @@ fn handle_main_events_cleared( .swap_buffers() .expect("Failed to swap window buffers!"); drop(guard); - tracing::trace!(tracy.frame_mark = true); + #[cfg(feature = "tracy")] + common::util::tracy_client::finish_continuous_frame!(); } if !exit {