Skip to content

Commit e61e296

Browse files
committed
smi: adjust to 80 columns
1 parent ffeac36 commit e61e296

File tree

1 file changed

+24
-17
lines changed
  • crates/amdgpu_top_tui/src

1 file changed

+24
-17
lines changed

crates/amdgpu_top_tui/src/smi.rs

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ impl SmiDeviceInfo {
8181

8282
fn info_header() -> TextView {
8383
let text = format!(concat!(
84-
"GPU {name:<name_len$} {pad:7} | {pci:<14} | {vram:^17} | {gtt:^17} |\n",
85-
"SCLK MCLK Temp Pwr_Avg/Cap | GFX% UMC% MM% |",
84+
"GPU {name:<name_len$} {pad:9}|{pci:<16}|{vram:^18}|\n",
85+
"SCLK MCLK Temp Pwr_Avg/Cap | GFX% UMC% MM% |{gtt:^18}|",
8686
),
8787
name = "Name",
8888
name_len = GPU_NAME_LEN,
89-
pci = "PCI Bus",
89+
pci = " PCI Bus",
9090
vram = "VRAM Usage",
91-
gtt = "GTT Usage",
91+
gtt = " GTT Usage",
9292
pad = "",
9393
);
9494

@@ -105,15 +105,13 @@ impl SmiDeviceInfo {
105105

106106
writeln!(
107107
self.info_text.buf,
108-
" #{i:<2} {name:GPU_NAME_LEN$} ({cu:3}CU) | {pci} | {vu:5} / {vt:5} MiB | {gu:5} / {gt:5} MiB |",
108+
" #{i:<2} {name:GPU_NAME_LEN$} ({cu:3}CU) | {pci} |{vu:6}/{vt:6} MiB |",
109109
i = self.instance,
110110
name = self.marketing_name,
111111
cu = self.cu_number,
112112
pci = self.pci_bus,
113113
vu = self.vram_usage.0.vram.heap_usage >> 20,
114114
vt = self.vram_usage.0.vram.total_heap_size >> 20,
115-
gu = self.vram_usage.0.gtt.heap_usage >> 20,
116-
gt = self.vram_usage.0.gtt.total_heap_size >> 20,
117115
)?;
118116

119117
if let Some(sclk) = &self.sensors.sclk {
@@ -142,7 +140,19 @@ impl SmiDeviceInfo {
142140
} else {
143141
write!(self.info_text.buf, " ____W / ____W ")?;
144142
}
145-
write!(self.info_text.buf, " |")?;
143+
144+
if self.check_gfxoff {
145+
match GfxoffStatus::get(self.instance) {
146+
Ok(GfxoffStatus::InGFXOFF) =>
147+
write!(self.info_text.buf, "GFXOFF|")?,
148+
/* for debug */
149+
Ok(GfxoffStatus::Unknown(val)) =>
150+
write!(self.info_text.buf, "Unknown ({val})|")?,
151+
_ => write!(self.info_text.buf, " |")?,
152+
}
153+
} else {
154+
write!(self.info_text.buf, " |")?;
155+
}
146156

147157
match self.amdgpu_dev.get_gpu_metrics_from_sysfs_path(&self.sysfs_path) {
148158
Ok(metrics) => {
@@ -161,6 +171,12 @@ impl SmiDeviceInfo {
161171
Err(_) => write!(self.info_text.buf, " ___% ___% ___%")?,
162172
}
163173
write!(self.info_text.buf, " |")?;
174+
write!(
175+
self.info_text.buf,
176+
"{gu:>6}/{gt:>6} MiB |",
177+
gu = self.vram_usage.0.gtt.heap_usage >> 20,
178+
gt = self.vram_usage.0.gtt.total_heap_size >> 20,
179+
)?;
164180
/*
165181
if let Some(fan_rpm) = self.sensors.fan_rpm {
166182
write!(self.info_text.buf, " {fan_rpm:4}RPM ")?;
@@ -169,15 +185,6 @@ impl SmiDeviceInfo {
169185
}
170186
*/
171187

172-
if self.check_gfxoff {
173-
match GfxoffStatus::get(self.instance) {
174-
Ok(GfxoffStatus::InGFXOFF) => write!(self.info_text.buf, " GFXOFF")?,
175-
/* for debug */
176-
Ok(GfxoffStatus::Unknown(val)) => write!(self.info_text.buf, " Unknown ({val})")?,
177-
_ => {},
178-
}
179-
}
180-
181188
self.info_text.set();
182189

183190
Ok(())

0 commit comments

Comments
 (0)