diff --git a/Cargo.lock b/Cargo.lock index 24b4c5b3ec92f49d2a29cc08e847787ed9206cab..a734982fbb72dc959923d1ac7f5a3f9a4804bdd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7107,7 +7107,6 @@ dependencies = [ "sum_tree", "taffy", "thiserror 2.0.12", - "tracy-client", "unicode-segmentation", "usvg", "util", @@ -12069,18 +12068,19 @@ dependencies = [ [[package]] name = "profiling" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" +checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" dependencies = [ "profiling-procmacros", + "tracy-client", ] [[package]] name = "profiling-procmacros" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" +checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b" dependencies = [ "quote", "syn 2.0.101", @@ -16890,17 +16890,6 @@ dependencies = [ "tracing-serde", ] -[[package]] -name = "tracing-tracy" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eaa1852afa96e0fe9e44caa53dc0bd2d9d05e0f2611ce09f97f8677af56e4ba" -dependencies = [ - "tracing-core", - "tracing-subscriber", - "tracy-client", -] - [[package]] name = "tracy-client" version = "0.18.2" @@ -20369,9 +20358,6 @@ dependencies = [ "time", "title_bar", "toolchain_selector", - "tracing", - "tracing-subscriber", - "tracing-tracy", "tracy-client", "tree-sitter-md", "tree-sitter-rust", diff --git a/Cargo.toml b/Cargo.toml index 58dd51ed14a33885b7823503a429cff941134bbe..0eb587331f840c80398e4e679e2cec3a58638fb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -595,7 +595,7 @@ portable-pty = "0.9.0" postage = { version = "0.5", features = ["futures-traits"] } pretty_assertions = { version = "1.3.0", features = ["unstable"] } proc-macro2 = "1.0.93" -profiling = "1" +profiling = "1.0.17" prost = "0.9" prost-build = "0.9" prost-types = "0.9" @@ -667,9 +667,6 @@ tokio = { version = "1" } tokio-tungstenite = { version = "0.26", features = ["__rustls-tls"] } toml = "0.8" tower-http = "0.4.4" -tracing = "0.1.40" -tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json", "registry", "tracing-log"] } # workaround for https://github.com/tokio-rs/tracing/issues/2927 -tracing-tracy = { version = "0.11.4", default-features = false, features = ["enable"] } tracy-client = { version = "0.18.2", default-features = false, features = ["enable", "demangle"] } tree-sitter = { version = "0.25.10", features = ["wasm"] } tree-sitter-bash = "0.25.0" diff --git a/crates/collab/Cargo.toml b/crates/collab/Cargo.toml index 8804f19f95184adbcd82fac8e02a6453e58d9ca1..d95b318b0e791b532a340bda94d945fb7c9485c1 100644 --- a/crates/collab/Cargo.toml +++ b/crates/collab/Cargo.toml @@ -64,8 +64,8 @@ tokio = { workspace = true, features = ["full"] } toml.workspace = true tower = "0.4" tower-http = { workspace = true, features = ["trace"] } -tracing.workspace = true -tracing-subscriber.workspace = true +tracing = "0.1.40" +tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json", "registry", "tracing-log"] } # workaround for https://github.com/tokio-rs/tracing/issues/2927 util.workspace = true uuid.workspace = true workspace-hack.workspace = true diff --git a/crates/gpui/Cargo.toml b/crates/gpui/Cargo.toml index da387d05f5f19d2526f89d402a36c6cd8cd30dcd..4544b561c33f4507e8264e4eed46711425ce2a04 100644 --- a/crates/gpui/Cargo.toml +++ b/crates/gpui/Cargo.toml @@ -72,7 +72,6 @@ screen-capture = [ "scap", ] windows-manifest = [] -tracy = ["dep:tracy-client"] [lib] path = "src/gpui.rs" @@ -125,7 +124,6 @@ strum.workspace = true sum_tree.workspace = true taffy = "=0.9.0" thiserror.workspace = true -tracy-client = { workspace = true, optional = true } util.workspace = true uuid.workspace = true waker-fn = "1.2.0" diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 1bf9b6c1791a7575d12da2d0933c54bbb222597f..66789bd7e6de8e08cd7365aef06c6e1577475927 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -129,10 +129,8 @@ pub struct Application(Rc); impl Application { /// Builds an app with the given asset source. #[allow(clippy::new_without_default)] + #[profiling::function] pub fn new() -> Self { - #[cfg(feature = "tracy")] - let _zone = tracy_client::span!(); - #[cfg(any(test, feature = "test-support"))] log::info!("GPUI was compiled in test mode"); @@ -174,13 +172,11 @@ impl Application { /// Start the application. The provided callback will be called once the /// app is fully launched. + #[profiling::function] pub fn run(self, on_finish_launching: F) where F: 'static + FnOnce(&mut App), { - #[cfg(feature = "tracy")] - let _zone = tracy_client::span!(); - let this = self.0.clone(); let platform = self.0.borrow().platform.clone(); platform.run(Box::new(move || { diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 6ca53861db50f355eaf899d3ed5860762ad99d9d..6818154c6d0b6ef35207df86eb40c5e499237154 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -19,7 +19,7 @@ name = "zed" path = "src/main.rs" [features] -tracy = ["dep:tracy-client", "dep:tracing", "dep:tracing-subscriber", "dep:tracing-tracy", "gpui/tracy"] +tracy = ["dep:tracy-client", "profiling/profile-with-tracy"] tracy-memory = ["tracy"] [dependencies] @@ -150,9 +150,6 @@ theme_selector.workspace = true time.workspace = true title_bar.workspace = true toolchain_selector.workspace = true -tracing = { workspace = true, optional = true } -tracing-subscriber = { workspace = true, optional = true } -tracing-tracy = { workspace = true, optional = true } tracy-client = { workspace = true, optional = true } ui.workspace = true ui_input.workspace = true diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 09ef9203a547452b52e3b5a60c0a72c8f34df430..0b546ebcff857dd632ef45012a38fdddf0ccd195 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -174,10 +174,8 @@ fn fail_to_open_window(e: anyhow::Error, _cx: &mut App) { } } +#[profiling::function] pub fn main() { - #[cfg(feature = "tracy")] - let _zone = tracy_client::span!(); - #[cfg(unix)] util::prevent_root_execution(); @@ -384,8 +382,7 @@ pub fn main() { }); app.run(move |cx| { - #[cfg(feature = "tracy")] - let _zone = tracy_client::span!(); + profiling::scope!("app_run"); menu::init(); zed_actions::init(); diff --git a/crates/zed/src/zed-main.rs b/crates/zed/src/zed-main.rs index 5fe18a6c64b3831b3691e11905d2ff4620f7196c..8f4ef0a062fcb7d28f44025fd35e707779a08180 100644 --- a/crates/zed/src/zed-main.rs +++ b/crates/zed/src/zed-main.rs @@ -4,14 +4,8 @@ pub fn main() { #[cfg(feature = "tracy")] { - use tracing_subscriber::layer::SubscriberExt; - tracy_client::register_demangler!(); tracy_client::Client::start(); - tracing::subscriber::set_global_default( - tracing_subscriber::registry().with(tracing_tracy::TracyLayer::default()), - ) - .expect("setup tracy layer"); } // separated out so that the file containing the main function can be imported by other crates,