[backend-comparison] Add Operating System information (#1531)

* [backend-comparison] Add Operating System information

* [backend-comparison] Simplify serialization of os info
This commit is contained in:
Sylvain Benner 2024-03-26 15:58:38 -04:00 committed by GitHub
parent 5bac300688
commit 28233d9f59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 43 additions and 2 deletions

19
Cargo.lock generated
View File

@ -205,6 +205,7 @@ dependencies = [
"derive-new",
"dirs 5.0.1",
"github-device-flow",
"os_info",
"rand",
"ratatui",
"reqwest",
@ -216,6 +217,7 @@ dependencies = [
"strum_macros",
"sysinfo",
"wgpu",
"wsl",
]
[[package]]
@ -3190,6 +3192,17 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "os_info"
version = "3.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae99c7fa6dd38c7cafe1ec085e804f8f555a2f8659b0dbe03f1f9963a9b51092"
dependencies = [
"log",
"serde",
"windows-sys 0.52.0",
]
[[package]]
name = "os_str_bytes"
version = "6.6.1"
@ -5437,6 +5450,12 @@ dependencies = [
"syn 2.0.55",
]
[[package]]
name = "wsl"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dab7ac864710bdea6594becbea5b5050333cf34fefb0dc319567eb347950d4"
[[package]]
name = "x11rb"
version = "0.13.0"

View File

@ -90,9 +90,11 @@ text_placeholder = "0.5.0"
pollster = "0.3"
wgpu = "0.18.0"
# Burnbench
# Benchmarks and Burnbench
arboard = "3.3.2"
github-device-flow = "0.2.0"
os_info = "3.8.2"
wsl = "0.1.0"
bincode = { version = "2.0.0-rc.3", features = [
"alloc",

View File

@ -34,7 +34,8 @@ clap = { workspace = true }
crossterm = { workspace = true, optional = true }
derive-new = { workspace = true }
dirs = { workspace = true }
github-device-flow = { workspace = true }
github-device-flow = { workspace = true }
os_info = { workspace = true }
rand = { workspace = true }
ratatui = { workspace = true, optional = true }
reqwest = {workspace = true, features = ["blocking", "json"]}
@ -44,6 +45,7 @@ strum = { workspace = true }
strum_macros = { workspace = true }
sysinfo = { workspace = true, features = ["serde"] }
wgpu = { workspace = true }
wsl = { workspace = true }
[dev-dependencies]
rstest = { workspace = true }

View File

@ -8,6 +8,23 @@ use wgpu;
pub(crate) struct BenchmarkSystemInfo {
cpus: Vec<String>,
gpus: Vec<String>,
os: BenchmarkOSInfo,
}
#[derive(Default, Clone, Serialize, Deserialize)]
pub(crate) struct BenchmarkOSInfo {
name: String,
#[serde(rename = "wsl")]
windows_linux_subsystem: bool,
}
impl From<os_info::Info> for BenchmarkOSInfo {
fn from(info: os_info::Info) -> Self {
BenchmarkOSInfo {
name: format!("{}", info),
windows_linux_subsystem: wsl::is_wsl(),
}
}
}
impl BenchmarkSystemInfo {
@ -15,6 +32,7 @@ impl BenchmarkSystemInfo {
Self {
cpus: BenchmarkSystemInfo::enumerate_cpus(),
gpus: BenchmarkSystemInfo::enumerate_gpus(),
os: BenchmarkOSInfo::from(os_info::get()),
}
}