diff options
author | David Wragg <david@rabbitmq.com> | 2010-09-24 16:45:20 +0100 |
---|---|---|
committer | David Wragg <david@rabbitmq.com> | 2010-09-24 16:45:20 +0100 |
commit | fb5dbdc90f43567032ce251053eff7908666e779 (patch) | |
tree | e105d02325a5925e80f09ad91894a189fc13de63 | |
parent | c63970927d153b59c576e6319ed406412d64cc02 (diff) | |
parent | 232a4b314092446c73840f5b00cb041cb0f0519a (diff) | |
download | rabbitmq-server-fb5dbdc90f43567032ce251053eff7908666e779.tar.gz |
Merge bug23300 into default
Any change to deps.mk causes all beams to be rebuilt
-rw-r--r-- | src/vm_memory_monitor.erl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/vm_memory_monitor.erl b/src/vm_memory_monitor.erl index e658f005..067fa9f2 100644 --- a/src/vm_memory_monitor.erl +++ b/src/vm_memory_monitor.erl @@ -296,6 +296,12 @@ get_total_memory({unix, sunos}) -> Dict = dict:from_list(lists:map(fun parse_line_sunos/1, Lines)), dict:fetch('Memory size', Dict); +get_total_memory({unix, aix}) -> + File = cmd("/usr/bin/vmstat -v"), + Lines = string:tokens(File, "\n"), + Dict = dict:from_list(lists:map(fun parse_line_aix/1, Lines)), + dict:fetch('memory pages', Dict) * 4096; + get_total_memory(_OsType) -> unknown. @@ -341,6 +347,17 @@ parse_line_sunos(Line) -> [Name] -> {list_to_atom(Name), none} end. +%% Lines look like " 12345 memory pages" +%% or " 80.1 maxpin percentage" +parse_line_aix(Line) -> + [Value | NameWords] = string:tokens(Line, " "), + Name = string:join(NameWords, " "), + {list_to_atom(Name), + case lists:member($., Value) of + true -> trunc(list_to_float(Value)); + false -> list_to_integer(Value) + end}. + freebsd_sysctl(Def) -> list_to_integer(cmd("/sbin/sysctl -n " ++ Def) -- "\n"). |