Merge amd-staging into amd-master 20220624

Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: Ieb7c5bc9c3480dabb8534a0be5839f00f60e100b
This commit is contained in:
Hao Zhou
2022-06-24 11:53:19 +08:00
5 changed files with 91 additions and 14 deletions
+32 -12
View File
@@ -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
@@ -1558,7 +1578,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()
@@ -1694,7 +1718,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()
@@ -1820,20 +1844,16 @@ def showOverDrive(deviceList, odtype):
ret = rocmsmi.rsmi_dev_overdrive_level_get(device, byref(rsmi_od))
od = rsmi_od.value
if not rsmi_ret_ok(ret, device):
printErrLog(device, 'Unable to retrieve sclk OverDrive level')
continue
elif odtype == 'mclk':
odStr = 'GPU Memory'
filePath = os.path.join('/sys/class/drm', 'card%d' % (device), 'device', 'pp_mclk_od')
if filePath:
try:
with open(filePath, 'r') as fileContents:
od = fileContents.read().rstrip('\n')
except:
printErrLog(device, 'Unable to retrieve mclk OverDrive level')
return None
ret = rocmsmi.rsmi_dev_mem_overdrive_level_get(device, byref(rsmi_od))
od = rsmi_od.value
if not rsmi_ret_ok(ret, device):
continue
else:
printErrLog(device, 'Unable to retrieve OverDrive')
logging.error('Unsupported clock type %s', clktype)
logging.error('Unsupported clock type %s', odtype)
RETCODE = 1
printLog(device, odStr + ' OverDrive value (%)', od)
printLogSpacer()