#74 probably fix

This commit is contained in:
lollipopkit
2023-07-21 16:56:50 +08:00
parent 262b4486e4
commit eef38f0949
14 changed files with 128 additions and 29 deletions

View File

@@ -14,6 +14,15 @@ class Cpus {
void update(List<OneTimeCpuStatus> newStatus) {
_pre = _now;
_now = newStatus;
// 类似 [NetSpeed.update] 的处理
// 虽然CPU热插拔情况较少...
if (_pre.length != _now.length) {
if (_pre.length > _now.length) {
_pre = _pre.sublist(0, _now.length);
} else {
_pre.addAll(_now.sublist(_pre.length, _now.length));
}
}
}
int get coresCount => _now.length;