Skip to content

Commit

Permalink
print error
Browse files Browse the repository at this point in the history
  • Loading branch information
CSY-ModelCloud committed Dec 5, 2024
1 parent b9a2f39 commit 9be31bc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions device_smi/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,14 @@ def metrics(self):
if platform.system().lower() == "windows":
command_result = _run(["wmic", "cpu", "get", "loadpercentage"]).strip()
command_result = re.sub(r'\n+', '\n', command_result)
result = command_result.split("\n")[1].split(",")
utilization = int(result[0])
try:
result = command_result.split("\n")[1].split(",")
utilization = int(result[0])
except BaseException as e:
print(f"error occurred, command_result: ")
print(f"{command_result}")
print(f"------------")
raise e

command_result = _run(["wmic", "os", "get", "FreePhysicalMemory"]).strip()
command_result = re.sub(r'\n+', '\n', command_result)
Expand Down

0 comments on commit 9be31bc

Please sign in to comment.