Don't rely on CpuStats.Percent
Just do the math client-side with TotalTicks and Reserved
This commit is contained in:
parent
18ad13cebf
commit
b693ff1886
|
@ -57,8 +57,13 @@ export default Model.extend({
|
||||||
return used / total;
|
return used / total;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
percentCPU: computed('stats.ResourceUsage.CpuStats.Percent', function() {
|
percentCPU: computed('cpuUsed', 'taskGroup.reservedCPU', function() {
|
||||||
return this.get('stats.ResourceUsage.CpuStats.Percent') || 0;
|
const used = this.get('cpuUsed');
|
||||||
|
const total = this.get('taskGroup.reservedCPU');
|
||||||
|
if (!total || !used) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return used / total;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
stats: computed('node.{isPartial,httpAddr}', function() {
|
stats: computed('node.{isPartial,httpAddr}', function() {
|
||||||
|
|
|
@ -172,7 +172,7 @@ test('each allocation should have high-level details for the allocation', functi
|
||||||
.find('td:eq(6)')
|
.find('td:eq(6)')
|
||||||
.text()
|
.text()
|
||||||
.trim(),
|
.trim(),
|
||||||
allocStats.resourceUsage.CpuStats.Percent,
|
Math.floor(allocStats.resourceUsage.CpuStats.TotalTicks) / cpuUsed,
|
||||||
'CPU %'
|
'CPU %'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|
|
@ -217,7 +217,7 @@ test('each allocation should show stats about the allocation, retrieved directly
|
||||||
.find('td:eq(6)')
|
.find('td:eq(6)')
|
||||||
.text()
|
.text()
|
||||||
.trim(),
|
.trim(),
|
||||||
allocStats.resourceUsage.CpuStats.Percent,
|
Math.floor(allocStats.resourceUsage.CpuStats.TotalTicks) / cpuUsed,
|
||||||
'CPU %'
|
'CPU %'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue