i did, in fact, put a second gpu in my system to test this

This commit is contained in:
SadlyNotSappho 2023-03-21 15:59:30 -07:00
parent 72cc42770a
commit 284cf2608b
2 changed files with 19 additions and 1 deletions

View File

@ -111,3 +111,16 @@ pub fn get_cpu() -> HashMap<String, u16> {
parsed parsed
} }
pub fn get_gpu() {
let binding = std::process::Command::new("lspci").output().expect("lspci failed");
let lspci = String::from_utf8_lossy(&binding.stdout).to_string();
let mut vga = vec![];
for line in lspci.lines() {
if line.contains("VGA") {
vga.push(line.split(":").collect::<Vec<&str>>()[2].trim())
}
}
println!("{:?}", vga);
}

View File

@ -6,6 +6,7 @@ fn main() {
let uptime = get_uptime(); let uptime = get_uptime();
let ram = get_ram(); let ram = get_ram();
let cpus = get_cpu(); let cpus = get_cpu();
let gpus = get_gpu();
// storage // storage
// cpu name/usage // cpu name/usage
@ -21,5 +22,9 @@ fn main() {
.map(|n| n.to_string()) .map(|n| n.to_string())
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join(", "); .join(", ");
println!("CPU Name(s): {}", cpu_name); println!(
"CPU Name{}: {}",
if cpus.len() == 1 { "" } else { "s" },
cpu_name
);
} }