Somewhat clean up dependency

Jakub Konka created

Change summary

Cargo.lock                            |  9 +++++----
Cargo.toml                            |  3 +--
crates/client/Cargo.toml              |  1 +
crates/client/src/client.rs           |  1 +
crates/debugger_ui/Cargo.toml         |  1 +
crates/debugger_ui/src/debugger_ui.rs |  1 +
crates/file_finder/Cargo.toml         |  1 -
crates/file_finder/src/file_finder.rs | 11 +----------
crates/gpui/Cargo.toml                |  4 ++--
crates/project/Cargo.toml             |  2 ++
crates/project/src/project.rs         |  1 +
crates/scheduler/Cargo.toml           |  1 -
crates/settings/Cargo.toml            |  1 +
crates/settings/src/settings.rs       |  1 +
crates/worktree/Cargo.toml            |  3 ++-
crates/worktree/src/worktree.rs       | 24 ++++++++----------------
crates/zed/Cargo.toml                 |  2 +-
crates/zed/src/main.rs                |  3 +++
crates/zed/src/zed.rs                 |  3 +++
19 files changed, 35 insertions(+), 38 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -3131,6 +3131,7 @@ dependencies = [
  "parking_lot",
  "paths",
  "postage",
+ "profiling",
  "rand 0.9.1",
  "regex",
  "release_channel",
@@ -4653,6 +4654,7 @@ dependencies = [
  "paths",
  "picker",
  "pretty_assertions",
+ "profiling",
  "project",
  "rpc",
  "schemars 1.0.1",
@@ -5925,7 +5927,6 @@ dependencies = [
  "settings",
  "text",
  "theme",
- "tracy-client-sys",
  "ui",
  "util",
  "workspace",
@@ -7112,7 +7113,6 @@ dependencies = [
  "taffy",
  "thiserror 2.0.12",
  "tracy-client",
- "tracy-client-sys",
  "unicode-segmentation",
  "usvg",
  "util",
@@ -12134,6 +12134,7 @@ dependencies = [
  "postage",
  "prettier",
  "pretty_assertions",
+ "profiling",
  "rand 0.9.1",
  "regex",
  "release_channel",
@@ -13963,7 +13964,6 @@ dependencies = [
  "futures 0.3.31",
  "parking_lot",
  "rand 0.9.1",
- "tracy-client-sys",
  "workspace-hack",
 ]
 
@@ -14492,6 +14492,7 @@ dependencies = [
  "log",
  "paths",
  "pretty_assertions",
+ "profiling",
  "release_channel",
  "rust-embed",
  "schemars 1.0.1",
@@ -19904,7 +19905,7 @@ dependencies = [
  "smol",
  "sum_tree",
  "text",
- "tracy-client-sys",
+ "tracy-client",
  "util",
  "workspace-hack",
  "zlog",

Cargo.toml 🔗

@@ -667,8 +667,7 @@ tokio = { version = "1" }
 tokio-tungstenite = { version = "0.26", features = ["__rustls-tls"] }
 toml = "0.8"
 tower-http = "0.4.4"
-tracy-client = { path = "../rust_tracy_client/tracy-client", features = ["fibers"] }
-tracy-client-sys = { path = "../rust_tracy_client/tracy-client-sys", features = ["fibers"] }
+tracy-client = { version = "0.18.2", features = ["fibers"] }
 tree-sitter = { version = "0.25.10", features = ["wasm"] }
 tree-sitter-bash = "0.25.0"
 tree-sitter-c = "0.23"

crates/client/Cargo.toml 🔗

@@ -37,6 +37,7 @@ log.workspace = true
 parking_lot.workspace = true
 paths.workspace = true
 postage.workspace = true
+profiling.workspace = true
 rand.workspace = true
 regex.workspace = true
 release_channel.workspace = true

crates/client/src/client.rs 🔗

@@ -150,6 +150,7 @@ pub fn init_settings(cx: &mut App) {
     ProxySettings::register(cx);
 }
 
+#[profiling::function]
 pub fn init(client: &Arc<Client>, cx: &mut App) {
     let client = Arc::downgrade(client);
     cx.on_action({

crates/debugger_ui/Cargo.toml 🔗

@@ -53,6 +53,7 @@ parse_int.workspace = true
 paths.workspace = true
 picker.workspace = true
 pretty_assertions.workspace = true
+profiling.workspace = true
 project.workspace = true
 rpc.workspace = true
 schemars.workspace = true

crates/debugger_ui/src/debugger_ui.rs 🔗

@@ -114,6 +114,7 @@ actions!(
     ]
 );
 
+#[profiling::function]
 pub fn init(cx: &mut App) {
     DebuggerSettings::register(cx);
     workspace::FollowableViewRegistry::register::<DebugSession>(cx);

crates/file_finder/Cargo.toml 🔗

@@ -34,7 +34,6 @@ util.workspace = true
 workspace.workspace = true
 workspace-hack.workspace = true
 profiling.workspace = true
-tracy-client-sys.workspace = true
 
 [dev-dependencies]
 ctor.workspace = true

crates/file_finder/src/file_finder.rs 🔗

@@ -152,20 +152,11 @@ impl FileFinder {
                 if project.is_local() {
                     let fs = fs.clone();
                     Some(cx.background_spawn(async move {
-                        let name =
-                            std::ffi::CString::new("Fiber: recent navigation history").unwrap();
-                        unsafe {
-                            tracy_client_sys::___tracy_fiber_enter(name.as_ptr());
-                        }
-                        let res = if fs.is_file(&abs_path).await {
+                        if fs.is_file(&abs_path).await {
                             Some(FoundPath::new(project_path, abs_path))
                         } else {
                             None
-                        };
-                        unsafe {
-                            tracy_client_sys::___tracy_fiber_leave();
                         }
-                        res
                     }))
                 } else {
                     Some(Task::ready(Some(FoundPath::new(project_path, abs_path))))

crates/gpui/Cargo.toml 🔗

@@ -72,6 +72,7 @@ screen-capture = [
     "scap",
 ]
 windows-manifest = []
+profile-with-tracy = ["dep:tracy-client"]
 
 [lib]
 path = "src/gpui.rs"
@@ -101,7 +102,6 @@ parking = "2.0.0"
 parking_lot.workspace = true
 postage.workspace = true
 profiling.workspace = true
-tracy-client-sys.workspace = true
 rand = { optional = true, workspace = true }
 raw-window-handle = "0.6"
 refineable.workspace = true
@@ -125,7 +125,7 @@ strum.workspace = true
 sum_tree.workspace = true
 taffy = "=0.9.0"
 thiserror.workspace = true
-tracy-client.workspace = true
+tracy-client = { workspace = true, optional = true }
 util.workspace = true
 uuid.workspace = true
 waker-fn = "1.2.0"

crates/project/Cargo.toml 🔗

@@ -25,6 +25,7 @@ test-support = [
     "dap/test-support",
     "dap_adapters/test-support",
 ]
+profile-with-tracy = ["worktree/profile-with-tracy"]
 
 [dependencies]
 aho-corasick.workspace = true
@@ -61,6 +62,7 @@ parking_lot.workspace = true
 paths.workspace = true
 postage.workspace = true
 prettier.workspace = true
+profiling.workspace = true
 rand.workspace = true
 regex.workspace = true
 remote.workspace = true

crates/project/src/project.rs 🔗

@@ -1000,6 +1000,7 @@ impl Project {
         AllAgentServersSettings::register(cx);
     }
 
+    #[profiling::function]
     pub fn init(client: &Arc<Client>, cx: &mut App) {
         connection_manager::init(client.clone(), cx);
         Self::init_settings(cx);

crates/scheduler/Cargo.toml 🔗

@@ -22,5 +22,4 @@ chrono.workspace = true
 futures.workspace = true
 parking_lot.workspace = true
 rand.workspace = true
-tracy-client-sys.workspace = true
 workspace-hack.workspace = true

crates/settings/Cargo.toml 🔗

@@ -25,6 +25,7 @@ gpui.workspace = true
 inventory.workspace = true
 log.workspace = true
 paths.workspace = true
+profiling.workspace = true
 release_channel.workspace = true
 rust-embed.workspace = true
 schemars.workspace = true

crates/settings/src/settings.rs 🔗

@@ -77,6 +77,7 @@ impl fmt::Display for WorktreeId {
 #[exclude = "*.DS_Store"]
 pub struct SettingsAssets;
 
+#[profiling::function]
 pub fn init(cx: &mut App) {
     let settings = SettingsStore::new(cx, &default_settings());
     cx.set_global(settings);

crates/worktree/Cargo.toml 🔗

@@ -21,6 +21,7 @@ test-support = [
     "text/test-support",
     "util/test-support",
 ]
+profile-with-tracy = ["dep:tracy-client"]
 
 [dependencies]
 anyhow.workspace = true
@@ -38,7 +39,6 @@ parking_lot.workspace = true
 paths.workspace = true
 postage.workspace = true
 profiling.workspace = true
-tracy-client-sys.workspace = true
 rpc = { workspace = true, features = ["gpui"] }
 serde.workspace = true
 serde_json.workspace = true
@@ -47,6 +47,7 @@ smallvec.workspace = true
 smol.workspace = true
 sum_tree.workspace = true
 text.workspace = true
+tracy-client = { workspace = true, optional = true }
 util.workspace = true
 workspace-hack.workspace = true
 

crates/worktree/src/worktree.rs 🔗

@@ -48,7 +48,7 @@ use std::{
     cmp::Ordering,
     collections::hash_map,
     convert::TryFrom,
-    ffi::{CString, OsStr},
+    ffi::OsStr,
     fmt,
     future::Future,
     mem::{self},
@@ -3083,25 +3083,15 @@ impl language::LocalFile for File {
         self.worktree.read(cx).absolutize(&self.path)
     }
 
+    #[profiling::function]
     fn load(&self, cx: &App) -> Task<Result<String>> {
-        profiling::scope!("File::load outer");
-        dbg!("File::load outer");
         let worktree = self.worktree.read(cx).as_local().unwrap();
         let abs_path = worktree.absolutize(&self.path);
         let fs = worktree.fs.clone();
 
-        cx.background_spawn(async move {
-            dbg!("File::load inner");
-            let name = CString::new("Fiber: load file").unwrap();
-            unsafe {
-                tracy_client_sys::___tracy_fiber_enter(name.as_ptr());
-            }
-            let content = fs.load(&abs_path).await;
-            unsafe {
-                tracy_client_sys::___tracy_fiber_leave();
-            }
-            content
-        })
+        cx.background_spawn(tracy_client::fiber!("File::load", async move {
+            fs.load(&abs_path).await
+        }))
     }
 
     #[profiling::function]
@@ -3109,7 +3099,9 @@ impl language::LocalFile for File {
         let worktree = self.worktree.read(cx).as_local().unwrap();
         let abs_path = worktree.absolutize(&self.path);
         let fs = worktree.fs.clone();
-        cx.background_spawn(async move { fs.load_bytes(&abs_path).await })
+        cx.background_spawn(tracy_client::fiber!("File::load_bytes", async move {
+            fs.load_bytes(&abs_path).await
+        }))
     }
 }
 

crates/zed/Cargo.toml 🔗

@@ -19,7 +19,7 @@ name = "zed"
 path = "src/main.rs"
 
 [features]
-profile-with-tracy = ["dep:tracy-client", "profiling/profile-with-tracy"]
+profile-with-tracy = ["dep:tracy-client", "profiling/profile-with-tracy", "gpui/profile-with-tracy", "project/profile-with-tracy"]
 profile-with-tracy-memory = ["profile-with-tracy"]
 
 [dependencies]

crates/zed/src/main.rs 🔗

@@ -1317,6 +1317,7 @@ fn parse_url_arg(arg: &str, cx: &App) -> String {
     }
 }
 
+#[profiling::function]
 fn load_embedded_fonts(cx: &App) {
     let asset_source = cx.asset_source();
     let font_paths = asset_source.list("fonts").unwrap();
@@ -1399,10 +1400,12 @@ fn eager_load_active_theme_and_icon_theme(fs: Arc<dyn Fs>, cx: &App) {
 }
 
 /// Spawns a background task to load the user themes from the themes directory.
+#[profiling::function]
 fn load_user_themes_in_background(fs: Arc<dyn fs::Fs>, cx: &mut App) {
     cx.spawn({
         let fs = fs.clone();
         async move |cx| {
+            profiling::scope!("load_user_themes_in_background");
             if let Some(theme_registry) = cx.update(|cx| ThemeRegistry::global(cx)).log_err() {
                 let themes_dir = paths::themes_dir().as_ref();
                 match fs

crates/zed/src/zed.rs 🔗

@@ -137,6 +137,7 @@ actions!(
     ]
 );
 
+#[profiling::function]
 pub fn init(cx: &mut App) {
     #[cfg(target_os = "macos")]
     cx.on_action(|_: &Hide, cx| cx.hide());
@@ -1222,6 +1223,7 @@ fn open_log_file(workspace: &mut Workspace, window: &mut Window, cx: &mut Contex
         .detach();
 }
 
+#[profiling::function]
 pub fn handle_settings_file_changes(
     mut user_settings_file_rx: mpsc::UnboundedReceiver<String>,
     mut global_settings_file_rx: mpsc::UnboundedReceiver<String>,
@@ -1329,6 +1331,7 @@ pub fn handle_settings_file_changes(
     .detach();
 }
 
+#[profiling::function]
 pub fn handle_keymap_file_changes(
     mut user_keymap_file_rx: mpsc::UnboundedReceiver<String>,
     cx: &mut App,