MCPcopy
hub / github.com/codeaashu/claude-code / getReport

Function getReport

src/utils/startupProfiler.ts:81–119  ·  view source on GitHub ↗

* Get a formatted report of all checkpoints * Only available when DETAILED_PROFILING is enabled

()

Source from the content-addressed store, hash-verified

79 * Only available when DETAILED_PROFILING is enabled
80 */
81function getReport(): string {
82 if (!DETAILED_PROFILING) {
83 return 'Startup profiling not enabled'
84 }
85
86 const perf = getPerformance()
87 const marks = perf.getEntriesByType('mark')
88 if (marks.length === 0) {
89 return 'No profiling checkpoints recorded'
90 }
91
92 const lines: string[] = []
93 lines.push('='.repeat(80))
94 lines.push('STARTUP PROFILING REPORT')
95 lines.push('='.repeat(80))
96 lines.push('')
97
98 let prevTime = 0
99 for (const [i, mark] of marks.entries()) {
100 lines.push(
101 formatTimelineLine(
102 mark.startTime,
103 mark.startTime - prevTime,
104 mark.name,
105 memorySnapshots[i],
106 8,
107 7,
108 ),
109 )
110 prevTime = mark.startTime
111 }
112
113 const lastMark = marks[marks.length - 1]
114 lines.push('')
115 lines.push(`Total startup time: ${formatMs(lastMark?.startTime ?? 0)}ms`)
116 lines.push('='.repeat(80))
117
118 return lines.join('\n')
119}
120
121let reported = false
122

Callers 1

profileReportFunction · 0.85

Calls 5

getPerformanceFunction · 0.85
formatTimelineLineFunction · 0.85
formatMsFunction · 0.85
entriesMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected