tracy: Rename features to profiling-with-tracy and profiling-with-tracy-memory

Jakub Konka created

Change summary

Cargo.lock                                     | 2 +-
Cargo.toml                                     | 2 +-
crates/gpui/src/platform/windows/dispatcher.rs | 2 ++
crates/gpui/src/platform/windows/platform.rs   | 1 +
crates/zed/Cargo.toml                          | 4 ++--
crates/zed/src/main.rs                         | 6 +++---
crates/zed/src/zed-main.rs                     | 3 +--
7 files changed, 11 insertions(+), 9 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -1460,6 +1460,7 @@ version = "0.1.0"
 dependencies = [
  "anyhow",
  "log",
+ "profiling",
  "simplelog",
  "windows 0.61.1",
  "winresource",
@@ -16898,7 +16899,6 @@ checksum = "ef54005d3d760186fd662dad4b7bb27ecd5531cdef54d1573ebd3f20a9205ed7"
 dependencies = [
  "loom",
  "once_cell",
- "rustc-demangle",
  "tracy-client-sys",
 ]
 

Cargo.toml 🔗

@@ -667,7 +667,7 @@ tokio = { version = "1" }
 tokio-tungstenite = { version = "0.26", features = ["__rustls-tls"] }
 toml = "0.8"
 tower-http = "0.4.4"
-tracy-client = { version = "0.18.2", default-features = false, features = ["enable", "demangle"] }
+tracy-client = "0.18.2"
 tree-sitter = { version = "0.25.10", features = ["wasm"] }
 tree-sitter-bash = "0.25.0"
 tree-sitter-c = "0.23"

crates/gpui/src/platform/windows/dispatcher.rs 🔗

@@ -53,6 +53,7 @@ impl WindowsDispatcher {
         let handler = {
             let mut task_wrapper = Some(runnable);
             WorkItemHandler::new(move |_| {
+                profiling::register_thread!();
                 task_wrapper.take().unwrap().run();
                 Ok(())
             })
@@ -64,6 +65,7 @@ impl WindowsDispatcher {
         let handler = {
             let mut task_wrapper = Some(runnable);
             TimerElapsedHandler::new(move |_| {
+                profiling::register_thread!();
                 task_wrapper.take().unwrap().run();
                 Ok(())
             })

crates/gpui/src/platform/windows/platform.rs 🔗

@@ -246,6 +246,7 @@ impl WindowsPlatform {
         std::thread::Builder::new()
             .name("VSyncProvider".to_owned())
             .spawn(move || {
+                profiling::register_thread!();
                 let vsync_provider = VSyncProvider::new();
                 loop {
                     vsync_provider.wait_for_vsync();

crates/zed/Cargo.toml 🔗

@@ -19,8 +19,8 @@ name = "zed"
 path = "src/main.rs"
 
 [features]
-tracy = ["dep:tracy-client", "profiling/profile-with-tracy"]
-tracy-memory = ["tracy"]
+profile-with-tracy = ["dep:tracy-client", "profiling/profile-with-tracy"]
+profile-with-tracy-memory = ["profile-with-tracy"]
 
 [dependencies]
 acp_tools.workspace = true

crates/zed/src/main.rs 🔗

@@ -59,16 +59,16 @@ use zed::{
 
 use crate::zed::OpenRequestKind;
 
-#[cfg(all(feature = "mimalloc", not(features = "tracy-memory")))]
+#[cfg(all(feature = "mimalloc", not(features = "profile-with-tracy-memory")))]
 #[global_allocator]
 static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
 
-#[cfg(all(feature = "mimalloc", features = "tracy-memory"))]
+#[cfg(all(feature = "mimalloc", features = "profile-with-tracy-memory"))]
 #[global_allocator]
 static GLOBAL: tracy_client::ProfiledAllocator<mimalloc::MiMalloc> =
     tracy_client::ProfiledAllocator::new(mimalloc::MiMalloc, 100);
 
-#[cfg(all(not(feature = "mimalloc"), feature = "tracy-memory"))]
+#[cfg(all(not(feature = "mimalloc"), feature = "profile-with-tracy-memory"))]
 #[global_allocator]
 static GLOBAL: tracy_client::ProfiledAllocator<std::alloc::System> =
     tracy_client::ProfiledAllocator::new(std::alloc::System, 100);

crates/zed/src/zed-main.rs 🔗

@@ -2,9 +2,8 @@
 #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
 
 pub fn main() {
-    #[cfg(feature = "tracy")]
+    #[cfg(feature = "profile-with-tracy")]
     {
-        tracy_client::register_demangler!();
         tracy_client::Client::start();
     }