fix(gui/metrics): fix GPU process type length

Signed-off-by: Xuehai Pan <XuehaiPan@pku.edu.cn>
This commit is contained in:
Xuehai Pan 2022-09-26 22:25:15 +08:00
parent 2f5c96944f
commit d7c31e90cf
3 changed files with 6 additions and 6 deletions

View file

@ -46,6 +46,10 @@ class GpuProcess(GpuProcessBase):
def as_snapshot(self, *, host_process_snapshot_cache=None) -> Snapshot:
snapshot = super().as_snapshot(host_process_snapshot_cache=host_process_snapshot_cache)
snapshot.type = snapshot.type.replace('C+G', 'X')
if snapshot.gpu_memory_human is NA and (host.WINDOWS or host.WSL):
snapshot.gpu_memory_human = 'WDDM:N/A'
snapshot.cpu_percent_string = snapshot.host.cpu_percent_string
snapshot.memory_percent_string = snapshot.host.memory_percent_string

View file

@ -14,7 +14,6 @@ from cachetools.func import ttl_cache
from nvitop.gui.library import (
HOSTNAME,
LARGE_INTEGER,
NA,
SUPERUSER,
USERCONTEXT,
USERNAME,
@ -261,7 +260,6 @@ class ProcessPanel(Displayable): # pylint: disable=too-many-instance-attributes
time_length = max(4, max((len(p.running_time_human) for p in snapshots), default=4))
for snapshot in snapshots:
snapshot.type = snapshot.type.replace('C+G', 'X')
snapshot.host_info = WideString(
'{:>5} {:>5} {} {}'.format(
snapshot.cpu_percent_string.replace('%', ''),
@ -271,8 +269,6 @@ class ProcessPanel(Displayable): # pylint: disable=too-many-instance-attributes
snapshot.command,
)
)
if snapshot.gpu_memory_human is NA and (host.WINDOWS or host.WSL):
snapshot.gpu_memory_human = 'WDDM:N/A'
with self.snapshot_lock:
self._snapshot_buffer = snapshots

View file

@ -411,8 +411,8 @@ class ProcessMetricsScreen(Displayable): # pylint: disable=too-many-instance-at
x = self.x + 7
for col, value in columns.items():
width = len(value)
self.addstr(self.y + 2, x, col.rjust(width))
self.addstr(self.y + 4, x, str(value + ' '))
self.addstr(self.y + 2, x, col.rjust(width) + ' ')
self.addstr(self.y + 4, x, str(value + ' '))
x += width + 1
x += 1