forked from platypush/platypush
[system
] Some versions of cpuinfo
may return cache sizes in human-readable format.
This commit is contained in:
parent
9a090d1b46
commit
20aeb0b72e
1 changed files with 13 additions and 0 deletions
|
@ -16,6 +16,19 @@ class CpuInfoBaseSchema(SystemBaseSchema):
|
||||||
if data.get('hz_actual'):
|
if data.get('hz_actual'):
|
||||||
data['frequency_actual'] = data.pop('hz_actual')[0]
|
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
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue