MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / getPhaseSummary

Function getPhaseSummary

src/utils/queryProfiler.ts:216–293  ·  view source on GitHub ↗

* Get phase-based summary showing time spent in each major phase

(
  marks: Array<{ name: string; startTime: number }>,
  baselineTime: number,
)

Source from the content-addressed store, hash-verified

214 * Get phase-based summary showing time spent in each major phase
215 */
216function getPhaseSummary(
217 marks: Array<{ name: string; startTime: number }>,
218 baselineTime: number,
219): string {
220 const phases: Array<{ name: string; start: string; end: string }> = [
221 {
222 name: 'Context loading',
223 start: 'query_context_loading_start',
224 end: 'query_context_loading_end',
225 },
226 {
227 name: 'Microcompact',
228 start: 'query_microcompact_start',
229 end: 'query_microcompact_end',
230 },
231 {
232 name: 'Autocompact',
233 start: 'query_autocompact_start',
234 end: 'query_autocompact_end',
235 },
236 { name: 'Query setup', start: 'query_setup_start', end: 'query_setup_end' },
237 {
238 name: 'Tool schemas',
239 start: 'query_tool_schema_build_start',
240 end: 'query_tool_schema_build_end',
241 },
242 {
243 name: 'Message normalization',
244 start: 'query_message_normalization_start',
245 end: 'query_message_normalization_end',
246 },
247 {
248 name: 'Client creation',
249 start: 'query_client_creation_start',
250 end: 'query_client_creation_end',
251 },
252 {
253 name: 'Network TTFB',
254 start: 'query_api_request_sent',
255 end: 'query_first_chunk_received',
256 },
257 {
258 name: 'Tool execution',
259 start: 'query_tool_execution_start',
260 end: 'query_tool_execution_end',
261 },
262 ]
263
264 const markMap = new Map(marks.map(m => [m.name, m.startTime - baselineTime]))
265
266 const lines: string[] = []
267 lines.push('')
268 lines.push('PHASE BREAKDOWN:')
269
270 for (const phase of phases) {
271 const startTime = markMap.get(phase.start)
272 const endTime = markMap.get(phase.end)
273

Callers 1

getQueryProfileReportFunction · 0.85

Calls 3

formatMsFunction · 0.85
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected