Skip to contentSkip to conversation

rteval: Construct a 'model name' on architectures that don't have one

PATCH Superseded John Kacur 1 participant 1 message Sep 9, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 2/3 rteval: Construct a 'model name' on architectures that don't have one

This is based on an idea from Punit Agrawal <[email protected]>

On architectures that lack 'model name' in /proc/cpuinfo create 'model name' Unknown when creating the per core dictionaries in cpuinfo

For arm, we can construct the 'model name' from the 'CPU implementer'
'CPU architecture'
'CPU variant'
'CPU part'
'CPU revision'

---
 rteval/misc.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
rteval/misc.py +21 -0
index 0dd361ff19fd..016fc7c4b494 100644
@@ -77,6 +77,27 @@ def cpuinfo():
             info[core] = {}
             continue
         info[core][key] = val
+
+    for (core, dict) in info.items():
+        if not 'model name' in dict:
+            # On Arm CPU implementer is present
+            # Construct the model_name from the following fields
+            if 'CPU implementer' in dict:
+                model_name = [dict.get('CPU implementer')]
+                model_name.append(dict.get('CPU architecture'))
+                model_name.append(dict.get('CPU variant'))
+                model_name.append(dict.get('CPU part'))
+                model_name.append(dict.get('CPU revision', ''))
+
+                # If a list item is None, remove it
+                model_name = [name for name in model_name if name]
+
+                # Convert the model_name list into a string
+                model_name = " ".join(model_name)
+                info[core]['model name'] = model_name
+            else:
+                info[core]['model name'] = 'Unknown'
+
     return info
 
 if __name__ == "__main__":
Signature · 1 line
2.31.1