--showtempgraph - Show N/A when no temp found

If temp in hwmon was missing - rocm-smi crashed.
e.g. /sys/class/drm/card1/device/hwmon/hwmon5/temp1_input

This change displays "N/A" for temp instead of crashing.

Change-Id: I02f84a466bd3acfbd9b65e7e4ca0f18e76606c3b
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>


[ROCm/rocm_smi_lib commit: 713f85721b]
Tento commit je obsažen v:
Galantsev, Dmitrii committed 2023-06-12 19:16:39 -05:00
1 rodič a9d4f69eea
revize 61ac3f8ca9
1 file changed
+5 -1
+5 -1
Zobrazit soubor
@@ -2563,8 +2563,12 @@ def printTempGraph(deviceList, delay):
if terminalWidth < originalTerminalWidth:
print('Terminal size cannot be decreased.\n\r')
return
if type(temp) == str:
tempString = temp
else:
tempString = str(int(temp))
# Two spare Spaces
tempString = (str(int(temp)) + '°C').ljust(5)
tempString = (tempString + '°C').ljust(5)
printStrings.append('\033[2;30;47mGPU[%d] Temp %s|%s%s\x1b[0m%s' % (device, tempString, color, paddingSpace[1:], remainderSpace))
originalTerminalWidth = terminalWidth
time.sleep((delay / 1000))