[core] Stats: Retrieve and set the GPU name if it is found

The GPU's name was never retrieved, meaning that whenever a GPU was
found, all its information was displayed, except for its name, although
it was expected on the QML side.

This commit fixes this issue.
This commit is contained in:
Candice Bentéjac 2023-04-26 11:02:52 +02:00
parent dda2493df9
commit c8237bbb0f

View file

@ -96,6 +96,11 @@ class ComputerStatistics:
smiTree = ET.fromstring(xmlGpu)
gpuTree = smiTree.find('gpu')
try:
self.gpuName = gpuTree.find('product_name').text
except Exception as e:
logging.debug('Failed to get gpuName: "{}".'.format(str(e)))
pass
try:
gpuMemoryUsed = gpuTree.find('fb_memory_usage').find('used').text.split(" ")[0]
self._addKV('gpuMemoryUsed', gpuMemoryUsed)
@ -105,6 +110,7 @@ class ComputerStatistics:
try:
self.gpuMemoryTotal = gpuTree.find('fb_memory_usage').find('total').text.split(" ")[0]
except Exception as e:
logging.debug('Failed to get gpuMemoryTotal: "{}".'.format(str(e)))
pass
try:
gpuUsed = gpuTree.find('utilization').find('gpu_util').text.split(" ")[0]