[`system`] Some versions of `cpuinfo` may return cache sizes in human-readable format.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Fabio Manganiello 2023-11-10 21:55:41 +01:00
parent 9a090d1b46
commit 20aeb0b72e
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 13 additions and 0 deletions

View File

@ -16,6 +16,19 @@ class CpuInfoBaseSchema(SystemBaseSchema):
if data.get('hz_actual'):
data['frequency_actual'] = data.pop('hz_actual')[0]
for key, value in data.items():
if key.endswith("_cache_size") and isinstance(value, str):
value, unit = value.split(" ")
value = int(value)
if unit == "KiB":
value *= 1024
elif unit == "MiB":
value *= 1024 * 1024
elif unit == "GiB":
value *= 1024 * 1024 * 1024
data[key] = value
return data