Make keys consistent

This commit is contained in:
Nick Mowen 2022-11-10 07:50:15 -07:00
parent bc205ad47d
commit cc7bae68d3
2 changed files with 7 additions and 9 deletions

View File

@ -800,11 +800,9 @@ def get_amd_gpu_stats() -> dict[str, str]:
for hw in usages: for hw in usages:
if "gpu" in hw: if "gpu" in hw:
results["gpu_usage"] = f"{hw.strip().split(' ')[1].replace('%', '')} %" results["gpu"] = f"{hw.strip().split(' ')[1].replace('%', '')} %"
elif "vram" in hw: elif "vram" in hw:
results[ results["mem"] = f"{hw.strip().split(' ')[1].replace('%', '')} %"
"memory_usage"
] = f"{hw.strip().split(' ')[1].replace('%', '')} %"
return results return results
@ -846,10 +844,10 @@ def get_intel_gpu_stats() -> dict[str, str]:
), ),
2, 2,
) )
results["gpu_usage"] = f"{gpu_usage} %" results["gpu"] = f"{gpu_usage} %"
break break
results["memory_usage"] = "- %" results["mem"] = "- %"
return results return results
@ -875,8 +873,8 @@ def get_nvidia_gpu_stats() -> dict[str, str]:
memory_percent = f"{round(float(usages[2].replace(' MiB', '').strip()) / float(usages[3].replace(' MiB', '').strip()) * 100, 1)} %" memory_percent = f"{round(float(usages[2].replace(' MiB', '').strip()) / float(usages[3].replace(' MiB', '').strip()) * 100, 1)} %"
results: dict[str, str] = { results: dict[str, str] = {
"name": usages[0], "name": usages[0],
"gpu_usage": usages[1].strip(), "gpu": usages[1].strip(),
"memory_usage": memory_percent, "mem": memory_percent,
} }
return results return results

View File

@ -157,7 +157,7 @@ export default function System() {
<Tbody> <Tbody>
<Tr> <Tr>
<Td>{gpu_usages[gpu]['gpu']}</Td> <Td>{gpu_usages[gpu]['gpu']}</Td>
<Td>{gpu_usages[gpu]['memory']}</Td> <Td>{gpu_usages[gpu]['mem']}</Td>
</Tr> </Tr>
</Tbody> </Tbody>
</Table> </Table>