UNPKG

@applitools/utils

Version:
14 lines (13 loc) 804 B
export type ProcessTableEntry = { ppid: number; rss: number; }; export type ProcessTable = Map<number, ProcessTableEntry>; /** Parse a single `/proc/<pid>/status` blob (linux). VmRSS is reported in kB. */ export declare function parseLinuxStatus(statusText: string): ProcessTableEntry | null; /** Parse `ps -A -o pid=,ppid=,rss=` output (macOS / posix). rss is reported in kB. */ export declare function parsePosixPsOutput(stdout: string): ProcessTable; /** Parse `Get-CimInstance Win32_Process | ConvertTo-Json` output (windows). WorkingSetSize is bytes. */ export declare function parseWindowsCimJson(stdout: string): ProcessTable; /** Sum rss (bytes) of `rootPid` and all transitive descendants. Cycle-safe. */ export declare function sumTreeRss(table: ProcessTable, rootPid: number): number;