Commit 642d5cc2 authored by Phil Renaud's avatar Phil Renaud
Browse files

Consolidate stats tracker consts, and add Usage to tracker test

No related merge requests found
Showing with 12 additions and 12 deletions
+12 -12
...@@ -49,12 +49,10 @@ class AllocationStatsTracker extends EmberObject.extend(AbstractStatsTracker) { ...@@ -49,12 +49,10 @@ class AllocationStatsTracker extends EmberObject.extend(AbstractStatsTracker) {
percent: percent(cpuUsed, this.reservedCPU), percent: percent(cpuUsed, this.reservedCPU),
}); });
let memoryUsed = 0; const memoryUsed =
if (frame.ResourceUsage.MemoryStats.Usage) { frame.ResourceUsage.MemoryStats.Usage ||
memoryUsed = frame.ResourceUsage.MemoryStats.Usage; frame.ResourceUsage.MemoryStats.RSS ||
} else { 0;
memoryUsed = frame.ResourceUsage.MemoryStats.RSS;
}
this.memory.pushObject({ this.memory.pushObject({
timestamp, timestamp,
...@@ -86,12 +84,10 @@ class AllocationStatsTracker extends EmberObject.extend(AbstractStatsTracker) { ...@@ -86,12 +84,10 @@ class AllocationStatsTracker extends EmberObject.extend(AbstractStatsTracker) {
percentStack: percentCpuTotal + aggregateCpu, percentStack: percentCpuTotal + aggregateCpu,
}); });
let taskMemoryUsed = 0; const taskMemoryUsed =
if (frame.ResourceUsage.MemoryStats.Usage) { frame.ResourceUsage.MemoryStats.Usage ||
taskMemoryUsed = frame.ResourceUsage.MemoryStats.Usage; frame.ResourceUsage.MemoryStats.RSS ||
} else { 0;
taskMemoryUsed = frame.ResourceUsage.MemoryStats.RSS;
}
const percentMemoryTotal = percent( const percentMemoryTotal = percent(
taskMemoryUsed / 1024 / 1024, taskMemoryUsed / 1024 / 1024,
......
...@@ -54,6 +54,7 @@ module('Unit | Util | AllocationStatsTracker', function () { ...@@ -54,6 +54,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
}, },
MemoryStats: { MemoryStats: {
RSS: (step + 400) * 1024 * 1024, RSS: (step + 400) * 1024 * 1024,
Usage: (step + 400) * 1024 * 1024,
}, },
}, },
Tasks: { Tasks: {
...@@ -64,6 +65,7 @@ module('Unit | Util | AllocationStatsTracker', function () { ...@@ -64,6 +65,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
}, },
MemoryStats: { MemoryStats: {
RSS: (step + 100) * 1024 * 1024, RSS: (step + 100) * 1024 * 1024,
Usage: (step + 100) * 1024 * 1024,
}, },
}, },
Timestamp: refDate + step, Timestamp: refDate + step,
...@@ -75,6 +77,7 @@ module('Unit | Util | AllocationStatsTracker', function () { ...@@ -75,6 +77,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
}, },
MemoryStats: { MemoryStats: {
RSS: (step + 50) * 1024 * 1024, RSS: (step + 50) * 1024 * 1024,
Usage: (step + 50) * 1024 * 1024,
}, },
}, },
Timestamp: refDate + step * 10, Timestamp: refDate + step * 10,
...@@ -86,6 +89,7 @@ module('Unit | Util | AllocationStatsTracker', function () { ...@@ -86,6 +89,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
}, },
MemoryStats: { MemoryStats: {
RSS: (step + 51) * 1024 * 1024, RSS: (step + 51) * 1024 * 1024,
Usage: (step + 51) * 1024 * 1024,
}, },
}, },
Timestamp: refDate + step * 100, Timestamp: refDate + step * 100,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment