export type ProcessRow = { pid: number; ppid: number; /** Resident set size in bytes. `ps` reports KB; converted once, here. */ rssBytes: number; command: string; }; /** * Parses `ps -axo pid,ppid,rss,command` output. * * Columns are right-aligned to widths that vary with the values, and the * command itself contains spaces — so the first three fields are split off and * everything after them is the command. A line that does not start with three * numbers is not a process row (the header, or a wrapped line) and is skipped * rather than failing the sample. */ export declare function parseProcessTable(output: string): ProcessRow[]; /** * Every process below `rootPid`, at any depth, excluding the root itself. * * Walks generation by generation rather than recursing per row: a build tree is * shallow but the machine's process table is not, and this visits each row once * per generation instead of once per ancestor. */ export declare function descendantsOf(rows: readonly ProcessRow[], rootPid: number): ProcessRow[]; /** Whether a row is one of the build's static-generation workers. */ export declare function isStaticGenWorker(row: ProcessRow): boolean; export type ProcessTableSample = { ok: true; rows: ProcessRow[]; } | { ok: false; reason: string; }; /** * One sample of the whole process table. * * The failure is reported rather than swallowed. An empty table and an * unreadable one look identical downstream — both yield no workers — and * reporting "nothing to measure" when the truth is "could not look" is the * silent false negative this tool exists to avoid. Seen for real: a sandbox * that denies `ps` turned a leaking build into a clean run. */ export declare function sampleProcessTable(): Promise;