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():
|
||||
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":
|
||||
|
|
Loading…
Reference in a new issue