[system] A more robust logic to parse cache size from cpuinfo.

This commit is contained in:
Fabio Manganiello 2024-01-04 13:55:08 +01:00
parent 9c3da7a2a9
commit 91a8fd3b56
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -18,8 +18,12 @@ class CpuInfoBaseSchema(SystemBaseSchema):
for key, value in data.items():
if key.endswith("_cache_size") and isinstance(value, str):
value, unit = value.split(" ")
value = int(value)
tokens = value.split(" ")
unit = None
if len(tokens) > 1:
unit = tokens[1]
value = int(tokens[0])
if unit == "KiB":
value *= 1024
elif unit == "MiB":