pyre-cli 4.13.0 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -504,15 +504,14 @@ async function collectProcesses(limit) {
504
504
  try {
505
505
  const isMac = process.platform === "darwin";
506
506
  const sortArg = isMac ? "-r" : "--sort=-pcpu";
507
- const threadsArg = isMac ? "threads" : "nlwp";
508
507
  const headClause = limit && limit > 0 ? ` | head -n ${limit + 1}` : "";
509
- const raw = (await run(`ps -eo pid,ppid,user,pcpu,pmem,state,${threadsArg},time,comm ${sortArg}${headClause}`)).trim();
508
+ const raw = (await run(`ps -eo pid,ppid,user,pcpu,pmem,state,time,comm ${sortArg}${headClause}`)).trim();
510
509
  const lines = raw.split("\n").slice(1);
511
510
  return lines.map((line) => {
512
- const parts = line.match(/\s*(\d+)\s+(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+(\d+)\s+([\d:.]+)\s+(.+)/);
511
+ const parts = line.match(/\s*(\d+)\s+(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+([\d:.]+)\s+(.+)/);
513
512
  if (!parts) return null;
514
- const runtimeSec = parts[8].split(":").reduce((acc, val, idx) => acc + parseInt(val) * Math.pow(60, 2 - idx), 0);
515
- return { pid: parseInt(parts[1]), ppid: parseInt(parts[2]), user: parts[3], cpu: parseFloat(parts[4]), mem: parseFloat(parts[5]), state: parts[6], threads: parseInt(parts[7]), runtime: runtimeSec, command: parts[9] };
513
+ const runtimeSec = parts[7].split(":").reduce((acc, val, idx) => acc + parseInt(val) * Math.pow(60, 2 - idx), 0);
514
+ return { pid: parseInt(parts[1]), ppid: parseInt(parts[2]), user: parts[3], cpu: parseFloat(parts[4]), mem: parseFloat(parts[5]), state: parts[6], threads: 0, runtime: runtimeSec, command: parts[8] };
516
515
  }).filter((p) => p !== null && p.pid > 0);
517
516
  } catch {
518
517
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-cli",
3
- "version": "4.13.0",
3
+ "version": "4.14.0",
4
4
  "description": "CLI Mac monitoring tool: temps, system stats, live dashboard, packet monitor, battery predictor, export",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -606,20 +606,19 @@ export async function collectNetwork(): Promise<NetworkData> {
606
606
 
607
607
  export async function collectProcesses(limit?: number): Promise<ProcessData[]> {
608
608
  try {
609
- const isMac = process.platform === 'darwin';
610
- const sortArg = isMac ? '-r' : '--sort=-pcpu';
611
- const threadsArg = isMac ? 'threads' : 'nlwp';
612
- const headClause = limit && limit > 0 ? ` | head -n ${limit + 1}` : '';
613
- const raw = (await run(`ps -eo pid,ppid,user,pcpu,pmem,state,${threadsArg},time,comm ${sortArg}${headClause}`)).trim();
614
- const lines = raw.split('\n').slice(1);
615
- return lines
616
- .map(line => {
617
- const parts = line.match(/\s*(\d+)\s+(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+(\d+)\s+([\d:.]+)\s+(.+)/);
618
- if (!parts) return null;
619
- const runtimeSec = parts[8].split(':').reduce((acc, val, idx) => acc + parseInt(val) * Math.pow(60, 2 - idx), 0);
620
- return { pid: parseInt(parts[1]), ppid: parseInt(parts[2]), user: parts[3], cpu: parseFloat(parts[4]), mem: parseFloat(parts[5]), state: parts[6], threads: parseInt(parts[7]), runtime: runtimeSec, command: parts[9] };
621
- })
622
- .filter((p): p is ProcessData => p !== null && p.pid > 0);
609
+ const isMac = process.platform === 'darwin';
610
+ const sortArg = isMac ? '-r' : '--sort=-pcpu';
611
+ const headClause = limit && limit > 0 ? ` | head -n ${limit + 1}` : '';
612
+ const raw = (await run(`ps -eo pid,ppid,user,pcpu,pmem,state,time,comm ${sortArg}${headClause}`)).trim();
613
+ const lines = raw.split('\n').slice(1);
614
+ return lines
615
+ .map(line => {
616
+ const parts = line.match(/\s*(\d+)\s+(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+([\d:.]+)\s+(.+)/);
617
+ if (!parts) return null;
618
+ const runtimeSec = parts[7].split(':').reduce((acc, val, idx) => acc + parseInt(val) * Math.pow(60, 2 - idx), 0);
619
+ return { pid: parseInt(parts[1]), ppid: parseInt(parts[2]), user: parts[3], cpu: parseFloat(parts[4]), mem: parseFloat(parts[5]), state: parts[6], threads: 0, runtime: runtimeSec, command: parts[8] };
620
+ })
621
+ .filter((p): p is ProcessData => p !== null && p.pid > 0);
623
622
  } catch {
624
623
  return [];
625
624
  }