fix(desktop): bind CPU exports to their capture sources

This commit is contained in:
LukeParkerDev 2026-09-04 09:57:10 +10:00
parent b4a6c8da3b
commit 6221beaa38

View file

@ -56,11 +56,10 @@ export function createProfiling(contents: WebContents, cdp: Cdp, files: BrowserF
),
)
if (cpu.result) return cpu.result
const resources = cpu.resources
clearTimeout(cpu.timer)
cpu.result = cdp.send("Profiler.stop").then(async ({ profile }) => ({
id: await files.save("profile.cpuprofile", "application/json", Buffer.from(JSON.stringify(profile)), [
...(cpu?.resources ?? []),
]),
id: await files.save("profile.cpuprofile", "application/json", Buffer.from(JSON.stringify(profile)), [...resources]),
durationMs: (profile.endTime - profile.startTime) / 1000,
}))
return cpu.result