memory usage unused

This commit is contained in:
huangdan 2015-05-31 16:27:46 +08:00
parent 35cf9d4b6a
commit 4d6e68e2ed
1 changed files with 11 additions and 2 deletions

View File

@ -71,12 +71,21 @@ scheduler_usage_diff(First, Last) ->
).
get_memory()->
[{Key, get_memory(Key, current)} || Key <- [used, allocated, unused]] ++ erlang:memory().
[{Key, get_memory(Key, current)} || Key <- [used, allocated, unused, usage]] ++ erlang:memory().
get_memory(used, Keyword) ->
lists:sum(lists:map(fun({_, Prop}) ->
container_size(Prop, Keyword, blocks_size)
end, util_alloc())).
end, util_alloc()));
get_memory(allocated, Keyword) ->
lists:sum(lists:map(fun({_, Prop})->
container_size(Prop, Keyword, carriers_size)
end, util_alloc()));
get_memory(unused, Keyword) ->
get_memory(allocated, Keyword) - get_memory(used, Keyword);
get_memory(usage, Keyword) ->
get_memory(used, Keyword) / get_memory(allocated, Keyword).
util_alloc()->
alloc(?UTIL_ALLOCATORS).