Added memory function for Solaris

This commit is contained in:
Jamie Cameron
2007-05-11 06:59:53 +00:00
parent d6cbd57a5c
commit 3137abc5e6
2 changed files with 23 additions and 0 deletions

View File

@@ -10,3 +10,5 @@ When running a command, you can now select which Unix user it will be run as.
The CPU type and speed is displayed on the processed by CPU usage page, on Linux systems.
---- Changes since 1.330 ----
On Virtuozzo systems, the free and used memory shown is determined by the VMs limits.
---- Changes since 1.340 ----
Free and used real and virtual memory is now displayed on Solaris.

View File

@@ -246,6 +246,27 @@ else {
}
}
# get_memory_info()
# Returns a list containing the real mem, free real mem, swap and free swap
# (In kilobytes).
sub get_memory_info
{
if (!&has_command("kstat")) {
return ( );
}
local %stat;
foreach my $s ("physmem", "freemem", "swap_alloc", "swap_avail") {
local $out = &backquote_command("kstat -p -m unix -s $s");
if ($out =~ /\s+(\d+)/) {
$stat{$s} = $1;
}
}
return ($stat{'physmem'}*8, $stat{'freemem'}*8,
$stat{'swap_alloc'}/1024, $stat{'swap_avail'}/1024);
}
foreach $ia (keys %text) {
if ($ia =~ /^sysv(_\S+)/) {
$info_arg_map{$1} = $text{$ia};