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