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

Consolidate stats tracker consts, and add Usage to tracker test

parent 85d97951
Showing with 12 additions and 12 deletions
+12 -12
......@@ -49,12 +49,10 @@ class AllocationStatsTracker extends EmberObject.extend(AbstractStatsTracker) {
percent: percent(cpuUsed, this.reservedCPU),
});
let memoryUsed = 0;
if (frame.ResourceUsage.MemoryStats.Usage) {
memoryUsed = frame.ResourceUsage.MemoryStats.Usage;
} else {
memoryUsed = frame.ResourceUsage.MemoryStats.RSS;
}
const memoryUsed =
frame.ResourceUsage.MemoryStats.Usage ||
frame.ResourceUsage.MemoryStats.RSS ||
0;
this.memory.pushObject({
timestamp,
......@@ -86,12 +84,10 @@ class AllocationStatsTracker extends EmberObject.extend(AbstractStatsTracker) {
percentStack: percentCpuTotal + aggregateCpu,
});
let taskMemoryUsed = 0;
if (frame.ResourceUsage.MemoryStats.Usage) {
taskMemoryUsed = frame.ResourceUsage.MemoryStats.Usage;
} else {
taskMemoryUsed = frame.ResourceUsage.MemoryStats.RSS;
}
const taskMemoryUsed =
frame.ResourceUsage.MemoryStats.Usage ||
frame.ResourceUsage.MemoryStats.RSS ||
0;
const percentMemoryTotal = percent(
taskMemoryUsed / 1024 / 1024,
......
......@@ -54,6 +54,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
},
MemoryStats: {
RSS: (step + 400) * 1024 * 1024,
Usage: (step + 400) * 1024 * 1024,
},
},
Tasks: {
......@@ -64,6 +65,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
},
MemoryStats: {
RSS: (step + 100) * 1024 * 1024,
Usage: (step + 100) * 1024 * 1024,
},
},
Timestamp: refDate + step,
......@@ -75,6 +77,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
},
MemoryStats: {
RSS: (step + 50) * 1024 * 1024,
Usage: (step + 50) * 1024 * 1024,
},
},
Timestamp: refDate + step * 10,
......@@ -86,6 +89,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
},
MemoryStats: {
RSS: (step + 51) * 1024 * 1024,
Usage: (step + 51) * 1024 * 1024,
},
},
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