MCPcopy
hub / github.com/claude-code-best/claude-code / measure

Function measure

src/utils/performanceShim.ts:44–66  ·  view source on GitHub ↗
(
  name: string,
  startMarkOrOptions?: string | MeasureOptions,
  endMark?: string,
)

Source from the content-addressed store, hash-verified

42}
43
44function measure(
45 name: string,
46 startMarkOrOptions?: string | MeasureOptions,
47 endMark?: string,
48): void {
49 let startTime: number
50 let duration: number
51
52 if (typeof startMarkOrOptions === 'string') {
53 const start = marks.get(startMarkOrOptions)
54 const end = endMark ? marks.get(endMark) : now()
55 startTime = start ?? now()
56 duration = (end ?? now()) - startTime
57 } else if (startMarkOrOptions && typeof startMarkOrOptions === 'object') {
58 startTime = startMarkOrOptions.start ?? 0
59 duration = (startMarkOrOptions.end ?? now()) - startTime
60 } else {
61 startTime = 0
62 duration = now()
63 }
64
65 measures.set(name, { name, startTime, duration })
66}
67
68interface MeasureOptions {
69 start?: number

Callers

nothing calls this directly

Calls 3

setMethod · 0.80
nowFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected