/** * `analyzeMemoryFootprint`: parses xctrace's memory-footprint schema. v1.15 item C. * * Distinct from analyzeAllocations: that tool surfaces category-level * cumulative allocation bytes ("which classes are bloated?"). This tool * surfaces process-level VM state ("how much RAM is the OS giving us * right now, and where is it going?"): resident memory, dirty memory, * VM regions, and the timeline of pressure events. * * The "why is my app getting OOM-killed?" investigation. iOS jetsam * decisions are made based on dirty + footprint, not cumulative malloc. */ import { z } from "zod"; import type { AnalyzeTraceOptions, DataStatus, SupportStatus } from "../types.js"; export declare const analyzeMemoryFootprintSchema: 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 AnalyzeMemoryFootprintInput = z.infer; export interface MemoryFootprintSample { startNs: number; startFmt?: string; /** Resident memory in bytes (RAM the process is using right now). */ residentBytes?: number; /** Dirty memory in bytes (the OOM-kill discriminator on iOS). */ dirtyBytes?: number; /** Compressed memory in bytes. */ compressedBytes?: number; /** Virtual memory in bytes (address-space, not necessarily resident). */ virtualBytes?: number; /** Optional sample-level label (e.g. "memory-warning", "background-event"). */ label?: string; } export interface AnalyzeMemoryFootprintResult { ok: boolean; tracePath: string; totals: { rows: number; /** Peak resident bytes seen across all samples. */ peakResidentBytes: number; /** Peak dirty bytes seen across all samples. */ peakDirtyBytes: number; /** Average resident bytes across all samples. */ averageResidentBytes: number; /** Time of peak resident as ns offset from recording start. */ peakResidentAtNs?: number; }; /** Top N samples ranked by resident bytes desc. */ topByResident: MemoryFootprintSample[]; diagnosis: string; /** @deprecated v1.14 item I. Use `supportStatus[]`. */ status: DataStatus; /** v1.14+. Unified per-area status. */ supportStatus: SupportStatus[]; } /** * Format a byte count as human-friendly KB/MB. v1.15. Exported for * the diagnosis text and downstream callers. */ export declare function formatBytes(n: number | undefined): string; /** Pure: turn the memory-footprint XML into the analyzed result. */ export declare function analyzeMemoryFootprintFromXml(xml: string, tracePath: string, topN?: number): AnalyzeMemoryFootprintResult; export declare function analyzeMemoryFootprint(input: AnalyzeMemoryFootprintInput, options?: AnalyzeTraceOptions): Promise;