/** * `analyzeLeakTimeline`: parses xctrace's leaks schema (the time-series * instrument), distinct from `leaks(1)` CLI which is a snapshot. v1.15 * item E. * * The xctrace `leaks` instrument samples the heap periodically during * recording and emits one row per leak event. Unlike leaks(1) (which * gives you "what is leaked NOW") this gives you "when did the leak * first appear, how did it grow, when did it peak?" Useful for fixing * leaks that only fire under certain user flows. * * Output: * - per-class first-seen-at timestamp * - growth rate (instances over time) * - peak instance count * - aggregate event count */ import { z } from "zod"; import type { AnalyzeTraceOptions, DataStatus, SupportStatus } from "../types.js"; export declare const analyzeLeakTimelineSchema: z.ZodObject<{ tracePath: z.ZodString; topN: z.ZodDefault; outputFormat: z.ZodOptional>; }, "strip", z.ZodTypeAny, { tracePath: string; topN: number; outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined; }, { tracePath: string; outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined; topN?: number | undefined; }>; export type AnalyzeLeakTimelineInput = z.infer; export interface LeakEvent { startNs: number; startFmt?: string; className: string; /** Cumulative count of this class at this point in the recording. */ cumulativeCount?: number; /** Bytes leaked at this point when xctrace exposes a size column. */ totalBytes?: number; } export interface LeakClassSummary { className: string; /** Timestamp the class first appeared as a leak. */ firstSeenAtNs: number; firstSeenAtFmt?: string; /** Highest cumulativeCount observed across all events. */ peakCount: number; /** Highest totalBytes observed across all events. */ peakBytes: number; /** Total events emitted for this class. */ eventCount: number; } export interface AnalyzeLeakTimelineResult { ok: boolean; tracePath: string; totals: { rows: number; /** Distinct class count across the timeline. */ classes: number; /** Latest timestamp seen, useful as a "leaks were still growing" check. */ lastEventNs?: number; }; /** Top N classes ranked by peakCount desc. */ topClasses: LeakClassSummary[]; diagnosis: string; /** @deprecated v1.14 item I. Use `supportStatus[]`. */ status: DataStatus; /** v1.14+. Unified per-area status. */ supportStatus: SupportStatus[]; } /** Pure: turn the leaks XML into the timeline analysis. */ export declare function analyzeLeakTimelineFromXml(xml: string, tracePath: string, topN?: number): AnalyzeLeakTimelineResult; export declare function analyzeLeakTimeline(input: AnalyzeLeakTimelineInput, options?: AnalyzeTraceOptions): Promise;