* Write the full trace to disk. Errors are logged but swallowed so that a * transient I/O problem does not crash the session — the next periodic tick * (or the final exit write) will retry with a complete snapshot.
()
| 988 | * (or the final exit write) will retry with a complete snapshot. |
| 989 | */ |
| 990 | async function periodicWrite(): Promise<void> { |
| 991 | if (!isEnabled || !tracePath || traceWritten) return |
| 992 | |
| 993 | try { |
| 994 | await mkdir(dirname(tracePath), { recursive: true }) |
| 995 | await writeFile(tracePath, buildTraceDocument()) |
| 996 | logForDebugging( |
| 997 | `[Perfetto] Periodic write: ${events.length} events to ${tracePath}`, |
| 998 | ) |
| 999 | } catch (error) { |
| 1000 | logForDebugging( |
| 1001 | `[Perfetto] Periodic write failed: ${errorMessage(error)}`, |
| 1002 | { level: 'error' }, |
| 1003 | ) |
| 1004 | } |
| 1005 | } |
| 1006 | |
| 1007 | /** |
| 1008 | * Final async write: close open spans and write the complete trace. |
no test coverage detected