Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
642d5cc2
Commit
642d5cc2
authored
2 years ago
by
Phil Renaud
Browse files
Options
Download
Email Patches
Plain Diff
Consolidate stats tracker consts, and add Usage to tracker test
parent
85d97951
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ui/app/utils/classes/allocation-stats-tracker.js
+8
-12
ui/app/utils/classes/allocation-stats-tracker.js
ui/tests/unit/utils/allocation-stats-tracker-test.js
+4
-0
ui/tests/unit/utils/allocation-stats-tracker-test.js
with
12 additions
and
12 deletions
+12
-12
ui/app/utils/classes/allocation-stats-tracker.js
+
8
-
12
View file @
642d5cc2
...
...
@@ -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
,
...
...
This diff is collapsed.
Click to expand it.
ui/tests/unit/utils/allocation-stats-tracker-test.js
+
4
-
0
View file @
642d5cc2
...
...
@@ -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
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help