getCpuUsagePercentage method
Implementation
Stream<double> getCpuUsagePercentage() async* {
var idleTotalPrev = <int>[0, 0];
while (true) {
var idleTotal = load();
var dTotal = idleTotal[0] - idleTotalPrev[0];
var dLoad = idleTotal[1] - idleTotalPrev[1];
idleTotalPrev = idleTotal;
var percent = 100.0 * (1.0 - dTotal / dLoad);
yield percent;
sleep(Duration(seconds: 1));
}
}