Show process sizes using sensible units https://github.com/webmin/webmin/issues/202

This commit is contained in:
Jamie Cameron
2015-04-13 22:34:02 -07:00
parent 9612e05536
commit c378e60ec7
6 changed files with 7 additions and 2 deletions

View File

@@ -42,7 +42,8 @@ print &ui_table_row($text{'owner'}, $pinfo{'user'});
print &ui_table_row($text{'cpu'}, $pinfo{'cpu'});
# Memory size
print &ui_table_row($text{'size'}, $pinfo{'size'});
print &ui_table_row($text{'size'}, $pinfo{'bytes'} ? &nice_size($pinfo{'bytes'})
: $pinfo{'size'});
# Run time
print &ui_table_row($text{'runtime'}, $pinfo{'time'});

View File

@@ -17,6 +17,7 @@ for($i=0; $line=<PS>; $i++) {
$plist[$i]->{"ppid"} = $2;
$plist[$i]->{"user"} = $3;
$plist[$i]->{"size"} = "$4 kB";
$plist[$i]->{"bytes"} = $4*1024;
$plist[$i]->{"cpu"} = $5;
$plist[$i]->{"time"} = $6;
$plist[$i]->{"nice"} = $7;

View File

@@ -40,7 +40,7 @@ foreach $pr (@procs) {
push(@cols, $p);
}
push(@cols, $pr->{'user'});
push(@cols, $pr->{'size'});
push(@cols, $pr->{'bytes'} ? &nice_size($pr->{'bytes'}) : $pr->{'size'});
push(@cols, &html_escape(&cut_string($pr->{'args'})));
print &ui_columns_row(\@cols);
}

View File

@@ -48,6 +48,7 @@ if ($ver >= 2) {
$plist[$i]->{"user"} = $w[0];
$plist[$i]->{"cpu"} = "$w[7] %";
$plist[$i]->{"size"} = "$w[8] kB";
$plist[$i]->{"bytes"} = $w[8]*1024;
$plist[$i]->{"time"} = $w[11];
$plist[$i]->{"_stime"} = $w[12];
$plist[$i]->{"nice"} = $w[9];

View File

@@ -15,6 +15,7 @@ for($i=0; $line=<PS>; $i++) {
$plist[$i]->{"ppid"} = $2;
$plist[$i]->{"user"} = $3;
$plist[$i]->{"size"} = "$4 kB";
$plist[$i]->{"bytes"} = $4 * 1024;
$plist[$i]->{"cpu"} = $5;
$plist[$i]->{"time"} = $6;
$plist[$i]->{"nice"} = $7;

View File

@@ -33,6 +33,7 @@ for($i=0; $line=<PS>; $i++) {
$plist[$i]->{"user"} = $w[0];
$plist[$i]->{"cpu"} = "$w[7] %";
$plist[$i]->{"size"} = "$w[8] kB";
$plist[$i]->{"bytes"} = $w[8]*1024;
local $ofs = 0;
if ($has_stime) {
$plist[$i]->{"_stime"} = $w[12+$ofs];