MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / nmTimedT

Function nmTimedT

src/resolution/name-matcher.ts:2196–2210  ·  view source on GitHub ↗
(stage: string, ref: UnresolvedRef, fn: () => T)

Source from the content-addressed store, hash-verified

2194 process.env.CODEGRAPH_RESOLVE_PROFILE === '2' ? new Map() : null;
2195
2196function nmTimedT<T>(stage: string, ref: UnresolvedRef, fn: () => T): T {
2197 if (!NM_PROFILE) return fn();
2198 const t0 = process.hrtime.bigint();
2199 const r = fn();
2200 const dt = process.hrtime.bigint() - t0;
2201 const key = `nm:${stage}|${ref.referenceKind}|${r ? 'hit' : 'miss'}`;
2202 const slot = NM_PROFILE.get(key);
2203 if (slot) {
2204 slot.n++;
2205 slot.ns += dt;
2206 } else {
2207 NM_PROFILE.set(key, { n: 1, ns: dt });
2208 }
2209 return r;
2210}
2211
2212function nmTimed(stage: string, ref: UnresolvedRef, fn: () => ResolvedRef | null): ResolvedRef | null {
2213 return nmTimedT(stage, ref, fn);

Callers 3

resolveMethodOnTypeFunction · 0.85
matchMethodCallFunction · 0.85
nmTimedFunction · 0.85

Calls 3

getMethod · 0.65
fnFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected