forked from platypush/platypush
[system] A more robust logic to parse cache size from cpuinfo
.
This commit is contained in:
parent
9c3da7a2a9
commit
91a8fd3b56
1 changed files with 6 additions and 2 deletions
|
@ -18,8 +18,12 @@ class CpuInfoBaseSchema(SystemBaseSchema):
|
||||||
|
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
if key.endswith("_cache_size") and isinstance(value, str):
|
if key.endswith("_cache_size") and isinstance(value, str):
|
||||||
value, unit = value.split(" ")
|
tokens = value.split(" ")
|
||||||
value = int(value)
|
unit = None
|
||||||
|
if len(tokens) > 1:
|
||||||
|
unit = tokens[1]
|
||||||
|
|
||||||
|
value = int(tokens[0])
|
||||||
if unit == "KiB":
|
if unit == "KiB":
|
||||||
value *= 1024
|
value *= 1024
|
||||||
elif unit == "MiB":
|
elif unit == "MiB":
|
||||||
|
|
Loading…
Reference in a new issue