MCPcopy
hub / github.com/CapSoftware/Cap / parsePsOutput

Function parsePsOutput

apps/desktop/scripts/desktop-memory-soak-lib.js:69–90  ·  view source on GitHub ↗
(output)

Source from the content-addressed store, hash-verified

67}
68
69export function parsePsOutput(output) {
70 return output
71 .split("\n")
72 .map((line) => line.trim())
73 .filter(Boolean)
74 .map((line) => {
75 const match = line.match(/^(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(.*)$/);
76
77 if (!match) return null;
78
79 const [, pid, rssKb, vszKb, etime, command] = match;
80
81 return {
82 command,
83 etimes: parseElapsedSeconds(etime),
84 pid: Number(pid),
85 rssKb: Number(rssKb),
86 vszKb: Number(vszKb),
87 };
88 })
89 .filter(Boolean);
90}
91
92export function classifyProcess(
93 command,

Callers 2

readProcessesFunction · 0.90

Calls 1

parseElapsedSecondsFunction · 0.85

Tested by

no test coverage detected