--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/amdsmi commit: 713f85721b]
Этот коммит содержится в:
Galantsev, Dmitrii
2023-06-12 19:02:46 -05:00
родитель 57e2ba5fe1
Коммит 80dd98d778
+5 -1
Просмотреть файл
@@ -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))