Skip to content

Commit

Permalink
Bug 1880373 - avoid failing browser_test_powerMetrics.js when a proce…
Browse files Browse the repository at this point in the history
…ss CPU time is 0ms for both glean and ProcInfo, r=gerard-majax.

Depends on D201886

Differential Revision: https://phabricator.services.mozilla.com/D201888

UltraBlame original commit: 24fe25ac92b6a6d622370a94013931d5d60b7c90
  • Loading branch information
marco-c committed Feb 16, 2024
1 parent f961062 commit 6c71e9c
Showing 1 changed file with 128 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1367,19 +1367,15 @@ label
)
)
{
Assert
.
greaterOrEqual
function
getCpuTime
(
cpuTimeByType
[
label
]
Math
.
floor
procInfo
)
{
return
(
beforeProcInfo
procInfo
.
children
.
Expand All @@ -1400,6 +1396,125 @@ cpuTime
/
kNS_PER_MS
)
;
}
let
beforeCpuTime
=
Math
.
floor
(
getCpuTime
(
beforeProcInfo
)
)
;
let
afterCpuTime
=
Math
.
ceil
(
getCpuTime
(
afterProcInfo
)
)
;
let
cpuTime
=
cpuTimeByType
[
label
]
;
if
(
afterCpuTime
=
=
0
)
{
Assert
.
equal
(
cpuTime
null
"
The
"
+
label
+
"
process
used
less
than
1ms
of
CPU
time
.
"
)
;
}
else
if
(
beforeCpuTime
=
=
0
&
&
cpuTime
=
=
=
null
)
{
info
(
"
The
"
+
label
+
"
process
might
have
used
used
less
than
1ms
of
CPU
time
.
"
)
;
}
else
{
Assert
.
greaterOrEqual
(
cpuTime
beforeCpuTime
"
reported
cpu
Expand Down Expand Up @@ -1428,35 +1543,8 @@ Assert
.
lessOrEqual
(
cpuTimeByType
[
label
]
Math
.
ceil
(
afterProcInfo
.
children
.
find
(
p
=
>
p
.
type
=
=
label
)
.
cpuTime
/
kNS_PER_MS
)
afterCpuTime
"
reported
cpu
Expand All @@ -1482,6 +1570,7 @@ returned
)
;
}
}
else
{
info
Expand Down

0 comments on commit 6c71e9c

Please sign in to comment.