Add memory to system specs
This commit is contained in:
parent
96ac650465
commit
f65fda2fa4
3 changed files with 46 additions and 6 deletions
|
@ -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<String>,
|
||||
app_version: &'static str,
|
||||
release_channel: &'static str,
|
||||
os_name: &'static str,
|
||||
os_version: Option<String>,
|
||||
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::<ReleaseChannel>().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::<ReleaseChannel>().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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue