Skip to content

Commit

Permalink
Fix page metrics evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
vpalmisano committed Sep 7, 2023
1 parent d921327 commit f51dcd8
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,6 @@ const describeJsHandle = async (jsHandle: JSHandle): Promise<string> => {
return ''
}

const metricsTotalDuration = (metrics: Metrics): number => {
return (
(metrics.LayoutDuration || 0) +
(metrics.RecalcStyleCount || 0) +
(metrics.ScriptDuration || 0) +
(metrics.TaskDuration || 0)
)
}

declare global {
let collectPeerConnectionStats: () => Promise<{
stats: RtcStats[]
Expand Down Expand Up @@ -1508,8 +1499,7 @@ window.GET_DISPLAY_MEDIA_CROP = "${crop}";
const elapsedTime = metrics.Timestamp - lastMetrics.Timestamp
if (elapsedTime > 10) {
const durationDiff =
metricsTotalDuration(metrics) -
metricsTotalDuration(lastMetrics)
(metrics.TaskDuration || 0) - (lastMetrics.TaskDuration || 0)
const usage = (100 * durationDiff) / elapsedTime
pageCpu[pageKey] = usage
pageMemory[pageKey] = (metrics.JSHeapUsedSize || 0) / 1e6
Expand Down

0 comments on commit f51dcd8

Please sign in to comment.