mirror of
https://github.com/webmin/webmin.git
synced 2026-06-20 19:30:30 +01:00
Use swap -l command to get virtual memory size
This commit is contained in:
@@ -225,9 +225,17 @@ foreach my $s ("physmem", "freemem", "swap_alloc", "swap_avail") {
|
||||
$stat{$s} = $1;
|
||||
}
|
||||
}
|
||||
local ($swaptotal, $swapfree);
|
||||
&open_execute_command(SWAP, "swap -l", 1);
|
||||
while(<SWAP>) {
|
||||
if (/^\S+\s+\d+,\d+\s+\d+\s+(\d+)\s+(\d+)/) {
|
||||
$swaptotal += $1;
|
||||
$swapfree += $2;
|
||||
}
|
||||
}
|
||||
close(SWAP);
|
||||
return ($stat{'physmem'}*8, $stat{'freemem'}*8,
|
||||
$stat{'swap_avail'}/1048576,
|
||||
($stat{'swap_avail'}-$stat{'swap_alloc'})/1048576);
|
||||
$swaptotal/2, $swapfree/2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user