diff --git a/Cargo.lock b/Cargo.lock index 57a7dde194..8bad1349cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2757,6 +2757,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +[[package]] +name = "human_bytes" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39b528196c838e8b3da8b665e08c30958a6f2ede91d79f2ffcd0d4664b9c64eb" + [[package]] name = "humantime" version = "2.1.0" @@ -3755,6 +3761,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "ntapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc51db7b362b205941f71232e56c625156eb9a929f8cf74a428fd5bc094a4afc" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -4424,7 +4439,7 @@ source = "git+https://github.com/zed-industries/wezterm?rev=5cd757e5f2eb039ed0c6 dependencies = [ "libc", "log", - "ntapi", + "ntapi 0.3.7", "winapi 0.3.9", ] @@ -6219,6 +6234,21 @@ dependencies = [ "libc", ] +[[package]] +name = "sysinfo" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccb297c0afb439440834b4bcf02c5c9da8ec2e808e70f36b0d8e815ff403bd24" +dependencies = [ + "cfg-if 1.0.0", + "core-foundation-sys", + "libc", + "ntapi 0.4.0", + "once_cell", + "rayon", + "winapi 0.3.9", +] + [[package]] name = "system-interface" version = "0.20.0" @@ -8180,6 +8210,7 @@ dependencies = [ "fuzzy", "go_to_line", "gpui", + "human_bytes", "ignore", "image", "indexmap", @@ -8213,6 +8244,7 @@ dependencies = [ "smallvec", "smol", "sum_tree", + "sysinfo", "tempdir", "terminal_view", "text", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 574111848c..1e3167d2b8 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -30,6 +30,7 @@ clock = { path = "../clock" } diagnostics = { path = "../diagnostics" } editor = { path = "../editor" } file_finder = { path = "../file_finder" } +human_bytes = "0.4.1" search = { path = "../search" } fs = { path = "../fs" } fsevent = { path = "../fsevent" } @@ -48,6 +49,7 @@ recent_projects = { path = "../recent_projects" } rpc = { path = "../rpc" } settings = { path = "../settings" } sum_tree = { path = "../sum_tree" } +sysinfo = "0.27.1" text = { path = "../text" } terminal_view = { path = "../terminal_view" } theme = { path = "../theme" } diff --git a/crates/zed/src/system_specs.rs b/crates/zed/src/system_specs.rs index 56eeeb8167..b6c2c0fcba 100644 --- a/crates/zed/src/system_specs.rs +++ b/crates/zed/src/system_specs.rs @@ -1,28 +1,33 @@ use std::{env, fmt::Display}; use gpui::AppContext; +use human_bytes::human_bytes; +use sysinfo::{System, SystemExt}; use util::channel::ReleaseChannel; pub struct SystemSpecs { - os_name: &'static str, - os_version: Option, app_version: &'static str, release_channel: &'static str, + os_name: &'static str, + os_version: Option, + memory: u64, architecture: &'static str, } impl SystemSpecs { pub fn new(cx: &AppContext) -> Self { let platform = cx.platform(); + let system = System::new_all(); SystemSpecs { + app_version: env!("CARGO_PKG_VERSION"), + release_channel: cx.global::().dev_name(), os_name: platform.os_name(), os_version: platform .os_version() .ok() .map(|os_version| os_version.to_string()), - app_version: env!("CARGO_PKG_VERSION"), - release_channel: cx.global::().dev_name(), + memory: system.total_memory(), architecture: env::consts::ARCH, } } @@ -35,8 +40,9 @@ impl Display for SystemSpecs { None => format!("OS: {}", self.os_name), }; let system_specs = [ - os_information, format!("Zed: {} ({})", self.app_version, self.release_channel), + os_information, + format!("Memory: {}", human_bytes(self.memory as f64)), format!("Architecture: {}", self.architecture), ] .join("\n");