UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

47 lines (46 loc) • 1.14 kB
import "./path-guards-TIjxtj6H.mjs"; import { n as createQueuedDiagnosticPhaseEmitter } from "./diagnostic-events-BjAH1Kbx.mjs"; import { performance } from "node:perf_hooks"; //#region src/infra/diff-read-timing.ts const DIFF_READ_STAGES = [ "admission", "checkout-resolve", "cache-validate", "worker-queue", "git-wall", "encode" ]; function addDiffReadDurations(e, t) { for (const n of DIFF_READ_STAGES) { const r = t.durations[n]; if (r !== void 0) e.durations[n] = (e.durations[n] ?? 0) + r; } } function startDiffReadTiming(e, t = performance.now()) { const n = createQueuedDiagnosticPhaseEmitter(); if (!n) return; return { durations: { "worker-queue": 0, "git-wall": 0 }, [Symbol.dispose]() { if (!this.outcome) return; try { const r = performance.now(); n({ name: e, startedAt: performance.timeOrigin + t, durationMs: r - t, details: { ...this.durations, outcome: this.outcome, ...this.missReason ? { missReason: this.missReason } : {} } }); } catch {} } }; } //#endregion export { startDiffReadTiming as n, addDiffReadDurations as t };