remove space before gpu statistic values

This commit is contained in:
Sergey Krashevich 2023-05-03 18:51:51 +03:00
parent e156ae7585
commit c0cadf280f
No known key found for this signature in database
GPG Key ID: 625171324E7D3856
2 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@ class TestGpuStats(unittest.TestCase):
process.stdout = self.amd_results
sp.return_value = process
amd_stats = get_amd_gpu_stats()
assert amd_stats == {"gpu": "4.17 %", "mem": "60.37 %"}
assert amd_stats == {"gpu": "4.17%", "mem": "60.37%"}
# @patch("subprocess.run")
# def test_nvidia_gpu_stats(self, sp):
@ -40,6 +40,6 @@ class TestGpuStats(unittest.TestCase):
sp.return_value = process
intel_stats = get_intel_gpu_stats()
assert intel_stats == {
"gpu": "1.34 %",
"mem": "- %",
"gpu": "1.34%",
"mem": "-%",
}

View File

@ -853,9 +853,9 @@ def get_amd_gpu_stats() -> dict[str, str]:
for hw in usages:
if "gpu" in hw:
results["gpu"] = f"{hw.strip().split(' ')[1].replace('%', '')} %"
results["gpu"] = f"{hw.strip().split(' ')[1].replace('%', '')}%"
elif "vram" in hw:
results["mem"] = f"{hw.strip().split(' ')[1].replace('%', '')} %"
results["mem"] = f"{hw.strip().split(' ')[1].replace('%', '')}%"
return results
@ -911,8 +911,8 @@ def get_intel_gpu_stats() -> dict[str, str]:
else:
video_avg = 1
results["gpu"] = f"{round((video_avg + render_avg) / 2, 2)} %"
results["mem"] = "- %"
results["gpu"] = f"{round((video_avg + render_avg) / 2, 2)}%"
results["mem"] = "-%"
return results