test(player): log media requests and WebKit processes around each Safari bench run

This commit is contained in:
Miguel Angel Simon Sierra
2026-11-10 09:19:56 -05:00
parent 5c57999756
commit 11a180bd2d
4 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ jobs:
working-directory: packages/player
run: |
sw_vers
CHROMEDRIVER="$CHROMEWEBDRIVER/chromedriver" bun run tests/perf/browsers/run.ts --browsers safari,chrome --runs 2
CHROMEDRIVER="$CHROMEWEBDRIVER/chromedriver" bun run tests/perf/browsers/run.ts --browsers safari --fixtures heavy-alpha-webm,heavy-alpha-hevc --runs 8
- name: Upload results
if: always()
@@ -121,6 +121,10 @@ export async function bench(cfg) {
const unstarted = videos()
.filter((v) => v.readyState === 0 && v.networkState === 2)
.map((v) => v.currentSrc.split("/").pop());
const all = videos().map((v) =>
[v.currentSrc.split("/").pop(), v.readyState, v.networkState, v.preload, v.error && v.error.code, v.buffered.length].join(":"),
);
e.message += ` [probe ${Date.now()} ${all.join(" ")}]`;
if (unstarted.length === 0) throw e;
throw new Error(`${e.message}: the browser never started loading ${unstarted.join(", ")}`);
});
@@ -325,6 +325,11 @@ try {
}
for (const fixture of fixtures) {
for (let run = 1; run <= runs; run++) {
const wc = execFileSync("ps", ["-axo", "pid=,etime=,rss=,comm="], { encoding: "utf-8" })
.split("\n")
.filter((l) => /WebKit\.(WebContent|GPU|Networking)/.test(l))
.map((l) => l.trim().replace(/\s+\S*\/com\.apple\.WebKit\./, " "));
console.log(`[probe] ${Date.now()} ${browser} ${fixture} run ${run} start: ${wc.join(" | ")}`);
try {
const { page, peakRssMb } = await runFilm(
`http://127.0.0.1:${port}`,
+2
View File
@@ -190,6 +190,8 @@ export function startServer(options: ServeOptions = {}): RunningServer {
if (path.startsWith("/fixtures/")) {
const rel = path.replace(/^\/fixtures\//, "");
if (rel.includes("_media/"))
console.log(`[probe] serve ${Date.now()} ${rel} range=${req.headers.get("range")}`);
const filePath = join(PATHS.fixturesDir, rel);
if (!filePath.startsWith(PATHS.fixturesDir)) {
return new Response("Forbidden", { status: 403 });