(name: string)
| 69 | * Record a checkpoint with the given name |
| 70 | */ |
| 71 | export function queryCheckpoint(name: string): void { |
| 72 | if (!ENABLED) return |
| 73 | |
| 74 | const perf = getPerformance() |
| 75 | perf.mark(name) |
| 76 | memorySnapshots.set(name, process.memoryUsage()) |
| 77 | |
| 78 | // Track first token specially |
| 79 | if (name === 'query_first_chunk_received' && firstTokenTime === null) { |
| 80 | const marks = perf.getEntriesByType('mark') |
| 81 | if (marks.length > 0) { |
| 82 | const lastMark = marks[marks.length - 1] |
| 83 | firstTokenTime = lastMark?.startTime ?? 0 |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * End the current query profiling session |
no test coverage detected