Sujet : Re: 🏳️🌈Apple requires too much money and sacrifice of control🏳️🌈
De : vallor (at) *nospam* cultnix.org (vallor)
Groupes : misc.phone.mobile.iphone comp.os.linux.advocacyDate : 06. Apr 2025, 05:31:07
Autres entêtes
Message-ID : <m5eecbF6lroU3@mid.individual.net>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
User-Agent : Pan/0.162 (Hmm4; f7d29671; Linux-6.14.0)
On 6 Apr 2025 03:35:26 GMT, vallor <
vallor@cultnix.org> wrote in
<
m5eb3uF6lroU2@mid.individual.net>:
Alas, Macs don't have /proc.
Would be nice if they did, though.
This works on a Mac:
#!/usr/bin/perl
open(PS,'ps -avmxww|') || die;
$header = <PS>;
while(<PS>)
{
$line = $_;
chomp($line);
$line =~ s/^\s+//;
($pid,$stat,$t,$sl,$re,$pagein,$vsz,$rss,$rest) = split(/\s+/,$line,9);
$proc{$pid}=$line;
$rss{$pid}=$rss;
$total_rss+=$rss;
}
@sorted = sort {$rss{$a} <=> $rss{$b}} (keys %rss);
foreach $pid (@sorted)
{
print $proc{$pid},"\n";
}
printf ("Total RSS: %d pages (%d bytes)\n",$total_rss,$total_rss*1024);
exit 0;
-- -v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti OS: Linux 6.14.0 Release: Mint 22.1 Mem: 258G "An unbreakable toy is useful for breaking other toys."