i did, in fact, put a second gpu in my system to test this
This commit is contained in:
parent
72cc42770a
commit
284cf2608b
13
src/lib.rs
13
src/lib.rs
|
@ -111,3 +111,16 @@ pub fn get_cpu() -> HashMap<String, u16> {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ fn main() {
|
|||
let uptime = get_uptime();
|
||||
let ram = get_ram();
|
||||
let cpus = get_cpu();
|
||||
let gpus = get_gpu();
|
||||
|
||||
// storage
|
||||
// cpu name/usage
|
||||
|
@ -21,5 +22,9 @@ fn main() {
|
|||
.map(|n| n.to_string())
|
||||
.collect::<Vec<String>>()
|
||||
.join(", ");
|
||||
println!("CPU Name(s): {}", cpu_name);
|
||||
println!(
|
||||
"CPU Name{}: {}",
|
||||
if cpus.len() == 1 { "" } else { "s" },
|
||||
cpu_name
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue