Skip to content

Commit fa663fc

Browse files
author
Lars T Hansen
committed
Add manufacturer to GPU output
1 parent 56748cc commit fa663fc

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/sysinfo.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ fn do_show_system(
2828
let (model, sockets, cores_per_socket, threads_per_core) = procfs::get_cpu_info(fs)?;
2929
let mem_by = procfs::get_memtotal_kib(fs)? * 1024;
3030
let mem_gib = (mem_by as f64 / GIB as f64).round() as i64;
31-
let mut cards = match gpu::probe() {
32-
Some(device) => match device.get_configuration() {
33-
Ok(cards) => cards,
34-
Err(_) => vec![],
35-
}
36-
None => vec![]
31+
let (mut cards, manufacturer) = match gpu::probe() {
32+
Some(device) =>
33+
(match device.get_configuration() {
34+
Ok(cards) => cards,
35+
Err(_) => vec![],
36+
},
37+
device.get_manufacturer()),
38+
None => (vec![], "UNKNOWN".to_string())
3739
};
3840
let hostname = hostname::get();
3941
let ht = if threads_per_core > 1 {
@@ -98,6 +100,7 @@ fn do_show_system(
98100
max_ce_clock_mhz,
99101
max_mem_clock_mhz,
100102
} = c;
103+
let manufacturer = util::json_quote(&manufacturer);
101104
let bus_addr = util::json_quote(bus_addr);
102105
let model = util::json_quote(model);
103106
let arch = util::json_quote(arch);
@@ -106,7 +109,7 @@ fn do_show_system(
106109
gpu_info += &format!(
107110
r###"
108111
{{"bus_addr":"{bus_addr}", "index":{index}, "uuid":"{uuid}",
109-
"model":"{model}", "arch":"{arch}", "driver":"{driver}", "firmware":"{firmware}",
112+
"manufacturer":"{manufacturer}", "model":"{model}", "arch":"{arch}", "driver":"{driver}", "firmware":"{firmware}",
110113
"mem_size_kib":{mem_size_kib},
111114
"power_limit_watt":{power_limit_watt}, "max_power_limit_watt":{max_power_limit_watt}, "min_power_limit_watt":{min_power_limit_watt},
112115
"max_ce_clock_mhz":{max_ce_clock_mhz}, "max_mem_clock_mhz":{max_mem_clock_mhz}}}"###

0 commit comments

Comments
 (0)