diff options
author | Lukas Larsson <[email protected]> | 2013-05-15 17:08:52 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2013-05-31 11:00:41 +0200 |
commit | fb4440038ea305929d7f46c0ea651994b412483f (patch) | |
tree | b7edd3f2aeff4e7f01974797608a28041256df57 /erts/preloaded/src | |
parent | 1932b1f4a9f4a8d083f9047b3ba1637dfea1c6d9 (diff) | |
download | otp-fb4440038ea305929d7f46c0ea651994b412483f.tar.gz otp-fb4440038ea305929d7f46c0ea651994b412483f.tar.bz2 otp-fb4440038ea305929d7f46c0ea651994b412483f.zip |
Replace gc stat lock with sched spec data
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/erlang.erl | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index 7106c0a4fb..6929ca3fa5 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -45,7 +45,8 @@ -export([alloc_info/1, alloc_sizes/1]). -export([gather_sched_wall_time_result/1, - await_sched_wall_time_modifications/2]). + await_sched_wall_time_modifications/2, + gather_gc_info_result/1]). -deprecated([hash/2]). @@ -3536,3 +3537,20 @@ sched_wall_time(Ref, N, Acc) -> {Ref, undefined} -> sched_wall_time(Ref, N-1, undefined); {Ref, SWT} -> sched_wall_time(Ref, N-1, [SWT|Acc]) end. + +-spec erlang:gather_gc_info_result(Ref) -> [{pos_integer(), + pos_integer(), + 0}] when + Ref :: reference(). + +gather_gc_info_result(Ref) when erlang:is_reference(Ref) -> + gc_info(Ref, erlang:system_info(schedulers), {0,0}). + +gc_info(_Ref, 0, {Colls,Recl}) -> + {Colls,Recl,0}; +gc_info(Ref, N, {OrigColls,OrigRecl}) -> + receive + {Ref, {_,Colls, Recl}} -> + gc_info(Ref, N-1, {Colls+OrigColls,Recl+OrigRecl}) + end. + |