[rocm_smi.py] Hiding unnecessary N/A lines

Hiding not applicable/unsupported sensors under INFO

Signed-off-by: Elena Sakhnovitch
Change-Id: I89c80ca7c6365ef3a2dd751a575ddf90044c8a2e


[ROCm/rocm_smi_lib commit: 0f88f59ddd]
This commit is contained in:
Elena Sakhnovitch
2022-06-09 19:52:38 -04:00
committed by Elena Sakhnovitch
parent 140656e176
commit 19bbfffbfc
@@ -462,6 +462,26 @@ def printErrLog(device, err):
logging.debug(errstr)
def printInfoLog(device, metricName, value):
""" Print out an info line to the SMI log
@param device: DRM device identifier
@param metricName: Title of the item to print to the log
@param value: The item's value to print to the log
"""
global PRINT_JSON
if not PRINT_JSON:
if value is not None:
logstr = 'GPU[%s]\t: %s: %s' % (device, metricName, value)
else:
logstr = 'GPU[%s]\t: %s' % (device, metricName)
if device is None:
logstr = logstr[13:]
logging.info(logstr)
def printEventList(device, delay, eventList):
""" Print out notification events for a specified device
@@ -1539,7 +1559,11 @@ def showCurrentTemps(deviceList):
printLogSpacer(' Temperature ')
for device in deviceList:
for sensor in temp_type_lst:
printLog(device, 'Temperature (Sensor %s) (C)' % (sensor), getTemp(device, sensor))
temp = getTemp(device, sensor)
if temp != 'N/A':
printLog(device, 'Temperature (Sensor %s) (C)' % (sensor), temp)
else:
printInfoLog(device, 'Temperature (Sensor %s) (C)' % (sensor), temp)
printLogSpacer()
@@ -1675,7 +1699,7 @@ def showGpuUse(deviceList):
for ut_counter in util_counters:
printLog(device, utilization_counter_name[ut_counter.type], ut_counter.val)
else:
printLog(device, 'GFX Activity', 'N/A')
printInfoLog(device, 'GFX Activity', 'N/A')
printLogSpacer()