MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / recordToolStat

Function recordToolStat

apps/vis/web/src/lib/analysis.ts:427–442  ·  view source on GitHub ↗
(map: Map<string, ToolStat>, node: ToolCallNode)

Source from the content-addressed store, hash-verified

425}
426
427function recordToolStat(map: Map<string, ToolStat>, node: ToolCallNode): void {
428 let s = map.get(node.name);
429 if (!s) {
430 s = { name: node.name, count: 0, errorCount: 0, truncatedCount: 0, timedCount: 0, totalMs: 0, avgMs: null, maxMs: null, totalOutputBytes: 0 };
431 map.set(node.name, s);
432 }
433 s.count += 1;
434 if (node.isError) s.errorCount += 1;
435 if (node.truncated) s.truncatedCount += 1;
436 if (node.outputBytes !== undefined) s.totalOutputBytes += node.outputBytes;
437 if (node.durationMs !== undefined) {
438 s.timedCount += 1;
439 s.totalMs += node.durationMs;
440 s.maxMs = s.maxMs === null ? node.durationMs : Math.max(s.maxMs, node.durationMs);
441 }
442}
443
444function summarize(
445 turns: readonly TurnNode[],

Callers 1

analyzeWireFunction · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected