summaryrefslogtreecommitdiffstats
path: root/perl-install/commands.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-03-05 22:43:46 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-03-05 22:43:46 +0000
commit26a387d5919bba9ccdb8a8447daa114204a997c4 (patch)
treec76ed77468ddcf8ff471514aa3b0eb2b0ee300c4 /perl-install/commands.pm
parent0bb6afa215fff585416bc88aa967c7e1eb61672e (diff)
downloaddrakx-26a387d5919bba9ccdb8a8447daa114204a997c4.tar
drakx-26a387d5919bba9ccdb8a8447daa114204a997c4.tar.gz
drakx-26a387d5919bba9ccdb8a8447daa114204a997c4.tar.bz2
drakx-26a387d5919bba9ccdb8a8447daa114204a997c4.tar.xz
drakx-26a387d5919bba9ccdb8a8447daa114204a997c4.zip
no_comment
Diffstat (limited to 'perl-install/commands.pm')
-rw-r--r--perl-install/commands.pm12
1 files changed, 8 insertions, 4 deletions
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;