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
Branches unavailable
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.4.0-rc.1
v1.4.0-beta.1
No related merge requests found
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) {
...
@@ -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
,
...
...
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 () {
...
@@ -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
,
...
...
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