[system] A more robust logic to parse cache size from `cpuinfo`.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Fabio Manganiello 2024-01-04 13:55:08 +01:00
parent 9c3da7a2a9
commit 91a8fd3b56
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 6 additions and 2 deletions

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":