Dump the CODEGRAPH_RESOLVE_PROFILE histogram to stderr (no-op when off).
(label: string)
| 1418 | |
| 1419 | /** Dump the CODEGRAPH_RESOLVE_PROFILE histogram to stderr (no-op when off). */ |
| 1420 | dumpResolveProfile(label: string): void { |
| 1421 | if (!this.resolveProfile || this.resolveProfile.size === 0) return; |
| 1422 | const rows = [...this.resolveProfile.entries()] |
| 1423 | .map(([k, v]) => ({ k, n: v.n, ms: Number(v.ns / 1_000_000n) })) |
| 1424 | .sort((a, b) => b.ms - a.ms); |
| 1425 | for (const r of rows) { |
| 1426 | console.error( |
| 1427 | `[resolve-profile] ${label} ${r.k}: n=${r.n} total=${(r.ms / 1000).toFixed(1)}s avg=${((r.ms * 1000) / Math.max(1, r.n)).toFixed(0)}µs` |
| 1428 | ); |
| 1429 | } |
| 1430 | // =2 only: this thread's matchReference sub-stage table rides along. |
| 1431 | dumpNameMatcherProfile(label); |
| 1432 | } |
| 1433 | |
| 1434 | resolveListForAdmission(refs: UnresolvedReference[]): { |
| 1435 | resolved: ResolvedRef[]; |
no test coverage detected