()
| 25 | } |
| 26 | |
| 27 | const collect = async () => { |
| 28 | if (!active()) return |
| 29 | const stack = await win.webContents.mainFrame.collectJavaScriptCallStack().catch((error) => { |
| 30 | writeLog("window", "failed to collect unresponsive sample", { window: name, error }, "error") |
| 31 | return undefined |
| 32 | }) |
| 33 | if (!active()) return |
| 34 | if (stack) samples.set(stack, (samples.get(stack) ?? 0) + 1) |
| 35 | schedule() |
| 36 | } |
| 37 | |
| 38 | const stopAndFlush = () => { |
| 39 | const wasSampling = sampling |