From 26a387d5919bba9ccdb8a8447daa114204a997c4 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 5 Mar 2000 22:43:46 +0000 Subject: no_comment --- perl-install/commands.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'perl-install/commands.pm') diff --git a/perl-install/commands.pm b/perl-install/commands.pm index ea09c200a..ace3cb395 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -271,21 +271,25 @@ sub cp { sub ps { @_ and die "usage: ps\n"; - my ($pid, $cpu, $cmd); + my ($pid, $rss, $cpu, $cmd); my ($uptime) = split ' ', first(cat_("/proc/uptime")); my $hertz = 100; + require c; + my $page = c::getpagesize() / 1024; + open PS, ">&STDOUT"; format PS_TOP = - PID %CPU CMD + PID RSS %CPU CMD . format PS = -@>>>> @>>> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$pid, $cpu, $cmd +@>>>> @>>>> @>>> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$pid, $rss, $cpu, $cmd . foreach $pid (sort {$a <=> $b} grep { /\d+/ } all('/proc')) { my @l = split(' ', cat_("/proc/$pid/stat")); $cpu = sprintf "%2.1f", max(0, min(99, ($l[13] + $l[14]) * 100 / $hertz / ($uptime - $l[21] / $hertz))); + $rss = (split ' ', cat_("/proc/$pid/stat"))[23] * $page; (($cmd) = cat_("/proc/$pid/cmdline")) =~ s/\0/ /g; $cmd ||= (split ' ', (cat_("/proc/$pid/stat"))[0])[1]; write PS; -- cgit v1.2.1