()
| 121 | let reported = false |
| 122 | |
| 123 | export function profileReport(): void { |
| 124 | if (reported) return |
| 125 | reported = true |
| 126 | |
| 127 | // Log to Statsig (sampled: 100% ant, 0.1% external) |
| 128 | logStartupPerf() |
| 129 | |
| 130 | // Output detailed report if CLAUDE_CODE_PROFILE_STARTUP=1 |
| 131 | if (DETAILED_PROFILING) { |
| 132 | // Write to file |
| 133 | const path = getStartupPerfLogPath() |
| 134 | const dir = dirname(path) |
| 135 | const fs = getFsImplementation() |
| 136 | fs.mkdirSync(dir) |
| 137 | writeFileSync_DEPRECATED(path, getReport(), { |
| 138 | encoding: 'utf8', |
| 139 | flush: true, |
| 140 | }) |
| 141 | |
| 142 | logForDebugging('Startup profiling report:') |
| 143 | logForDebugging(getReport()) |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | export function isDetailedProfilingEnabled(): boolean { |
| 148 | return DETAILED_PROFILING |
no test coverage detected