Skip to content

Commit 97166fb

Browse files
Liviu RauDevtools-frontend LUCI CQ
authored andcommitted
Revert "Reland "Port test/perf to non-hosted""
This reverts commit 34bd889. Reason for revert: the runner is timing out https://ci.chromium.org/ui/p/devtools-frontend/builders/ci/Stand-alone%20Linux/22381/overview Original change's description: > Reland "Port test/perf to non-hosted" > > This is a reland of commit fc6a604 > > Renamed mocha_hooks.ts back to test_setup.ts. That way the contents of the file will be reset and it can be renamed later without the risk of mocha picking up old unsupported hooks. > > Original change's description: > > Port test/perf to non-hosted > > > > Bug: 448015235 > > Change-Id: Ibbfe022bd6e708f6d45b4062120d1e5f30e3f410 > > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7002908 > > Reviewed-by: Paul Irish <[email protected]> > > Commit-Queue: Liviu Rau <[email protected]> > > Bug: 448015235 > Change-Id: I10c3130444ca82c98b281e8b5ac11be56644af9f > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7016407 > Reviewed-by: Jack Franklin <[email protected]> > Commit-Queue: Liviu Rau <[email protected]> Bug: 448015235 No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: Ifa1ad5c3d20cdfb3986b8f61fa97bc9afaf0d135 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7016232 Bot-Commit: Rubber Stamper <[email protected]> Reviewed-by: Nikolay Vitkov <[email protected]> Commit-Queue: Liviu Rau <[email protected]>
1 parent 3f78cda commit 97166fb

File tree

12 files changed

+177
-104
lines changed

12 files changed

+177
-104
lines changed

test/perf/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ group("perf") {
1414

1515
node_ts_library("tests") {
1616
deps = [
17-
"../e2e_non_hosted/conductor:implementation",
1817
"application",
1918
"helpers",
2019
"panels/performance",

test/perf/application/BUILD.gn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
import("../../../scripts/build/typescript/typescript.gni")
66

7-
ts_e2e_library("application") {
7+
node_ts_library("application") {
88
sources = [ "boot-perf_test.ts" ]
99

1010
deps = [
1111
"../../shared",
12+
"../helpers",
1213
"../report",
1314
]
1415
}

test/perf/application/boot-perf_test.ts

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,65 @@
44

55
import {performance} from 'perf_hooks';
66

7-
import {measurements} from '../report/report.js';
7+
import {reloadDevTools} from '../../shared/helper.js';
8+
import {mean, percentile} from '../helpers/perf-helper.js';
9+
import {addBenchmarkResult, type Benchmark} from '../report/report.js';
810

911
describe('Boot performance', () => {
1012
const RUNS = 10;
13+
const testValues = {
14+
name: 'BootPerf',
15+
values: [] as number[],
16+
};
17+
18+
after(() => {
19+
const values = testValues.values;
20+
const meanMeasure = Number(mean(values).toFixed(2));
21+
const percentile50 = Number(percentile(values, 0.5).toFixed(2));
22+
const percentile90 = Number(percentile(values, 0.9).toFixed(2));
23+
const percentile99 = Number(percentile(values, 0.99).toFixed(2));
24+
25+
const benchmark: Benchmark = {
26+
key: {test: testValues.name, units: 'ms'},
27+
measurements: {
28+
stats: [
29+
{
30+
value: 'mean',
31+
measurement: meanMeasure,
32+
},
33+
{
34+
value: 'percentile50',
35+
measurement: percentile50,
36+
},
37+
{
38+
value: 'percentile90',
39+
measurement: percentile90,
40+
},
41+
{
42+
value: 'percentile99',
43+
measurement: percentile99,
44+
},
45+
],
46+
},
47+
};
48+
addBenchmarkResult(benchmark);
49+
/* eslint-disable no-console */
50+
console.log(`Benchmark name: ${testValues.name}`);
51+
console.log(`Mean boot time: ${meanMeasure}ms`);
52+
console.log(`50th percentile boot time: ${percentile50}ms`);
53+
console.log(`90th percentile boot time: ${percentile90}ms`);
54+
console.log(`99th percentile boot time: ${percentile99}ms`);
55+
/* eslint-enable no-console */
56+
});
1157

1258
for (let run = 1; run <= RUNS; run++) {
13-
it(`run ${run}/${RUNS}`, async ({devToolsPage}) => {
59+
it(`run ${run}/${RUNS}`, async () => {
1460
const start = performance.now();
15-
await devToolsPage.reload();
61+
await reloadDevTools();
1662

1763
// Ensure only 2 decimal places.
1864
const timeTaken = (performance.now() - start).toFixed(2);
19-
measurements.BootPerf.push(Number(timeTaken));
65+
testValues.values.push(Number(timeTaken));
2066
});
2167
}
2268
});

test/perf/helpers/BUILD.gn

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import("../../../scripts/build/typescript/typescript.gni")
66

7-
ts_e2e_library("helpers") {
7+
node_ts_library("helpers") {
88
sources = [ "perf-helper.ts" ]
9-
deps = [ "../../e2e_non_hosted/conductor:implementation" ]
109
}

test/perf/mocharc.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ spec.unshift(path.join(__dirname, 'setup', 'test_setup.js'));
1111

1212
module.exports = {
1313
spec,
14-
require :
15-
[
16-
path.join(path.dirname(__dirname), 'perf', 'setup', 'test_setup.js'),
17-
path.join(path.dirname(__dirname), 'e2e_non_hosted', 'conductor', 'mocha_hooks.js'),
18-
'source-map-support/register'
19-
],
14+
require : [path.join(path.dirname(__dirname), 'conductor', 'mocha_hooks.js'), 'source-map-support/register'],
2015
timeout : TestConfig.debug ? 0 : 10_000,
2116
retries : TestConfig.retries,
2217
reporter : path.join(path.dirname(__dirname), 'shared', 'mocha-resultsdb-reporter'),

test/perf/panels/performance/BUILD.gn

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
import("../../../../scripts/build/typescript/typescript.gni")
66

7-
ts_e2e_library("performance") {
7+
node_ts_library("performance") {
88
sources = [ "trace-load_test.ts" ]
99

1010
deps = [
1111
"../../../../front_end/panels/timeline:bundle",
12+
"../../../conductor:implementation",
1213
"../../../e2e/helpers",
13-
"../../../e2e_non_hosted/conductor:implementation",
14+
"../../../shared",
15+
"../../helpers",
1416
"../../report",
1517
]
1618
}

test/perf/panels/performance/trace-load_test.ts

Lines changed: 93 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ import {GEN_DIR} from '../../../conductor/paths.js';
99
import {
1010
navigateToPerformanceTab,
1111
} from '../../../e2e/helpers/performance-helpers.js';
12-
import type {DevToolsPage} from '../../../e2e_non_hosted/shared/frontend-helper.js';
13-
import type {InspectedPage} from '../../../e2e_non_hosted/shared/target-helper.js';
14-
import {measurements} from '../../report/report.js';
12+
import {
13+
getBrowserAndPages,
14+
reloadDevTools,
15+
waitFor,
16+
waitForFunction,
17+
} from '../../../shared/helper.js';
18+
import {mean, percentile} from '../../helpers/perf-helper.js';
19+
import {addBenchmarkResult, type Benchmark} from '../../report/report.js';
1520

16-
async function timeFixture(fixture: string, devToolsPage: DevToolsPage, inspectedPage: InspectedPage): Promise<number> {
17-
await navigateToPerformanceTab(undefined, devToolsPage, inspectedPage);
18-
const panelElement = await devToolsPage.waitFor('.widget.panel.timeline');
21+
async function timeFixture(fixture: string): Promise<number> {
22+
const {frontend} = getBrowserAndPages();
23+
await navigateToPerformanceTab();
24+
const panelElement = await waitFor('.widget.panel.timeline');
1925
await panelElement.evaluate(el => {
2026
// @ts-expect-error page context.
2127
window.perfDuration = 0;
@@ -25,12 +31,12 @@ async function timeFixture(fixture: string, devToolsPage: DevToolsPage, inspecte
2531
window.perfDuration = ev.duration;
2632
}, {once: true});
2733
});
28-
const uploadProfileHandle = await devToolsPage.waitFor('input[type=file]');
34+
const uploadProfileHandle = await waitFor('input[type=file]');
2935
await uploadProfileHandle.uploadFile(path.join(GEN_DIR, `front_end/panels/timeline/fixtures/traces/${fixture}.gz`));
3036
// We use wait for function to avoid long running evaluation calls to
3137
// avoid protocol-level timeouts.
32-
return await devToolsPage.waitForFunction(async () => {
33-
const result = await devToolsPage.evaluate(() => {
38+
return await waitForFunction(async () => {
39+
const result = await frontend.evaluate(() => {
3440
// @ts-expect-error page context.
3541
return window.perfDuration;
3642
});
@@ -42,34 +48,98 @@ async function timeFixture(fixture: string, devToolsPage: DevToolsPage, inspecte
4248
}
4349

4450
describe('Performance panel trace load performance', () => {
51+
const allTestValues: Array<{name: string, values: number[]}> = [];
4552
// Skipped because this throws range errors
46-
describe.skip('[crbug.com/433466849] Large CPU profile load benchmark', function() {
53+
describe.skip('[crbug.com/433466849] Large CPU profile load benchmark', () => {
54+
beforeEach(async () => {
55+
// Reload devtools to get a fresh version of the panel on each
56+
// run and prevent a skew due to caching, etc.
57+
await reloadDevTools();
58+
});
4759
const RUNS = 10;
48-
this.timeout(40_000);
49-
60+
const testValues = {
61+
name: 'LargeCPULoad',
62+
values: [] as number[],
63+
};
5064
for (let run = 1; run <= RUNS; run++) {
51-
it('run large cpu profile benchmark', async ({devToolsPage, inspectedPage}) => {
52-
await devToolsPage.reload();
53-
const duration = await timeFixture('large-profile.cpuprofile', devToolsPage, inspectedPage);
65+
it('run large cpu profile benchmark', async function() {
66+
this.timeout(40_000);
67+
const duration = await timeFixture('large-profile.cpuprofile');
5468
// Ensure only 2 decimal places.
5569
const timeTaken = Number(duration.toFixed(2));
56-
measurements.LargeCPULoad.push(timeTaken);
70+
testValues.values.push(timeTaken);
5771
});
5872
}
73+
after(() => {
74+
allTestValues.push(testValues);
75+
});
5976
});
6077

61-
describe('Large DOM trace load benchmark', function() {
78+
describe('Large DOM trace load benchmark', () => {
79+
beforeEach(async () => {
80+
// Reload devtools to get a fresh version of the panel on each
81+
// run and prevent a skew due to caching, etc.
82+
await reloadDevTools();
83+
});
6284
const RUNS = 10;
63-
this.timeout(8_000);
64-
85+
const testValues = {
86+
name: 'LargeDOMTraceLoad',
87+
values: [] as number[],
88+
};
6589
for (let run = 1; run <= RUNS; run++) {
66-
it('run large dom trace load benchmark', async ({devToolsPage, inspectedPage}) => {
67-
await devToolsPage.reload();
68-
const duration = await timeFixture('dom-size-long.json', devToolsPage, inspectedPage);
90+
it('run large dom trace load benchmark', async function() {
91+
this.timeout(8_000);
92+
const duration = await timeFixture('dom-size-long.json');
6993
// Ensure only 2 decimal places.
7094
const timeTaken = Number(duration.toFixed(2));
71-
measurements.LargeDOMTraceLoad.push(timeTaken);
95+
testValues.values.push(timeTaken);
7296
});
7397
}
98+
after(() => {
99+
allTestValues.push(testValues);
100+
});
101+
});
102+
103+
after(async () => {
104+
// Calculate statistics for each benchmark.
105+
for (const testValues of allTestValues) {
106+
const values = testValues.values;
107+
const meanMeasure = Number(mean(values).toFixed(2));
108+
const percentile50 = Number(percentile(values, 0.5).toFixed(2));
109+
const percentile90 = Number(percentile(values, 0.9).toFixed(2));
110+
const percentile99 = Number(percentile(values, 0.99).toFixed(2));
111+
112+
const benchmark: Benchmark = {
113+
key: {test: testValues.name, units: 'ms'},
114+
measurements: {
115+
stats: [
116+
{
117+
value: 'mean',
118+
measurement: meanMeasure,
119+
},
120+
{
121+
value: 'percentile50',
122+
measurement: percentile50,
123+
},
124+
{
125+
value: 'percentile90',
126+
measurement: percentile90,
127+
},
128+
{
129+
value: 'percentile99',
130+
measurement: percentile99,
131+
},
132+
],
133+
},
134+
};
135+
addBenchmarkResult(benchmark);
136+
/* eslint-disable no-console */
137+
console.log(`Benchmark name: ${testValues.name}`);
138+
console.log(`Mean time: ${meanMeasure}ms`);
139+
console.log(`50th percentile time: ${percentile50}ms`);
140+
console.log(`90th percentile time: ${percentile90}ms`);
141+
console.log(`99th percentile time: ${percentile99}ms`);
142+
/* eslint-enable no-console */
143+
}
74144
});
75145
});

test/perf/report/BUILD.gn

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
import("../../../scripts/build/typescript/typescript.gni")
66

77
node_ts_library("report") {
8-
deps = [
9-
"../../shared",
10-
"../helpers",
11-
]
8+
deps = [ "../../shared" ]
129
sources = [ "report.ts" ]
1310
}

test/perf/report/report.ts

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as fs from 'fs';
66
import {join} from 'path';
77

88
import * as ts from '../../conductor/test_config.js';
9-
import {mean, percentile} from '../helpers/perf-helper.js';
109

1110
const results: Benchmark[] = [];
1211

@@ -65,51 +64,3 @@ export function writeReport() {
6564
// eslint-disable-next-line no-console
6665
console.log(`perf report file was written to ${filePath}`);
6766
}
68-
69-
export const measurements: Record<string, number[]> = {
70-
BootPerf: [] as number[],
71-
LargeDOMTraceLoad: [] as number[],
72-
LargeCPULoad: [] as number[],
73-
};
74-
75-
export function collectMeasurements() {
76-
for (const name in measurements) {
77-
const values = measurements[name];
78-
const meanMeasure = Number(mean(values).toFixed(2));
79-
const percentile50 = Number(percentile(values, 0.5).toFixed(2));
80-
const percentile90 = Number(percentile(values, 0.9).toFixed(2));
81-
const percentile99 = Number(percentile(values, 0.99).toFixed(2));
82-
83-
const benchmark: Benchmark = {
84-
key: {test: name, units: 'ms'},
85-
measurements: {
86-
stats: [
87-
{
88-
value: 'mean',
89-
measurement: meanMeasure,
90-
},
91-
{
92-
value: 'percentile50',
93-
measurement: percentile50,
94-
},
95-
{
96-
value: 'percentile90',
97-
measurement: percentile90,
98-
},
99-
{
100-
value: 'percentile99',
101-
measurement: percentile99,
102-
},
103-
],
104-
},
105-
};
106-
addBenchmarkResult(benchmark);
107-
/* eslint-disable no-console */
108-
console.log(`Benchmark name: ${name}`);
109-
console.log(`Mean time: ${meanMeasure}ms`);
110-
console.log(`50th percentile time: ${percentile50}ms`);
111-
console.log(`90th percentile time: ${percentile90}ms`);
112-
console.log(`99th percentile time: ${percentile99}ms`);
113-
/* eslint-enable no-console */
114-
}
115-
}

test/perf/setup/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import("../../../scripts/build/typescript/typescript.gni")
66

7-
ts_e2e_library("setup") {
7+
node_ts_library("setup") {
88
sources = [ "test_setup.ts" ]
99
deps = [ "../report" ]
1010
}

0 commit comments

Comments
 (0)