()
| 36 | } |
| 37 | |
| 38 | const stopAndFlush = () => { |
| 39 | const wasSampling = sampling |
| 40 | sampling = false |
| 41 | clearTimers() |
| 42 | if (samples.size === 0) return wasSampling |
| 43 | |
| 44 | const entries = [...samples.entries()].sort((a, b) => b[1] - a[1]) |
| 45 | const total = entries.reduce((sum, entry) => sum + entry[1], 0) |
| 46 | const message = [ |
| 47 | "renderer unresponsive samples", |
| 48 | `Window: ${name}`, |
| 49 | `URL: ${win.isDestroyed() ? "<destroyed>" : win.webContents.getURL()}`, |
| 50 | ...entries.map((entry) => `<${entry[1]}> ${entry[0]}`), |
| 51 | `Total Samples: ${total}`, |
| 52 | ].join("\n") |
| 53 | writeLog("window", message, undefined, "error") |
| 54 | samples.clear() |
| 55 | return wasSampling |
| 56 | } |
| 57 | |
| 58 | const start = () => { |
| 59 | if (sampling || win.isDestroyed() || win.webContents.isDestroyed() || win.webContents.isDevToolsOpened()) return |
nothing calls this directly
no test coverage detected