diff options
author | Patrik Nyblom <[email protected]> | 2012-02-07 19:51:24 +0100 |
---|---|---|
committer | Patrik Nyblom <[email protected]> | 2012-02-07 19:51:24 +0100 |
commit | d0394af6541d99bd72192d35fc4986016c3a6589 (patch) | |
tree | 8251b6147db0ea64f90b25b941d951c58bb150a2 /erts/preloaded | |
parent | e9e34e8bd838ef99ed3bd0e88ff490614cbe78a1 (diff) | |
parent | 6004ec3e1785913ff0b74054cf614a35c180d54a (diff) | |
download | otp-d0394af6541d99bd72192d35fc4986016c3a6589.tar.gz otp-d0394af6541d99bd72192d35fc4986016c3a6589.tar.bz2 otp-d0394af6541d99bd72192d35fc4986016c3a6589.zip |
Merge branch 'maint'
Conflicts:
erts/doc/src/erlang.xml
erts/preloaded/ebin/erlang.beam
Diffstat (limited to 'erts/preloaded')
-rw-r--r-- | erts/preloaded/ebin/erlang.beam | bin | 84904 -> 86368 bytes | |||
-rw-r--r-- | erts/preloaded/src/erlang.erl | 42 |
2 files changed, 42 insertions, 0 deletions
diff --git a/erts/preloaded/ebin/erlang.beam b/erts/preloaded/ebin/erlang.beam Binary files differindex e73d55eaec..cfd2a50431 100644 --- a/erts/preloaded/ebin/erlang.beam +++ b/erts/preloaded/ebin/erlang.beam diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index e042c0a072..2c1821df40 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -43,6 +43,9 @@ -export([memory/0, memory/1]). -export([alloc_info/1, alloc_sizes/1]). +-export([gather_sched_wall_time_result/1, + await_sched_wall_time_modifications/2]). + -deprecated([hash/2]). %% Get rid of autoimports of spawn to avoid clashes with ourselves. @@ -1863,6 +1866,11 @@ spawn_opt(_Tuple) -> (runtime) -> {Total_Run_Time, Time_Since_Last_Call} when Total_Run_Time :: non_neg_integer(), Time_Since_Last_Call :: non_neg_integer(); + (scheduler_wall_time) -> [{Scheduler_Id, Scheduler_Worked_Time, Scheduler_Total_Time}] | + undefined when + Scheduler_Id :: pos_integer(), + Scheduler_Worked_Time :: non_neg_integer(), + Scheduler_Total_Time :: non_neg_integer(); (wall_clock) -> {Total_Wallclock_Time, Wallclock_Time_Since_Last_Call} when Total_Wallclock_Time :: non_neg_integer(), @@ -1908,6 +1916,9 @@ subtract(_,_) -> (scheduler_bind_type, How) -> OldBindType when How :: scheduler_bind_type() | default_bind, OldBindType :: scheduler_bind_type(); + (scheduler_wall_time, Boolean) -> OldBoolean when + Boolean :: boolean(), + OldBoolean :: boolean(); (schedulers_online, SchedulersOnline) -> OldSchedulersOnline when SchedulersOnline :: pos_integer(), @@ -3246,3 +3257,34 @@ receive_allocator(Ref, N, Acc) -> {Ref, _, InfoList} -> receive_allocator(Ref, N-1, insert_info(InfoList, Acc)) end. + +-spec erlang:await_sched_wall_time_modifications(Ref, Result) -> boolean() when + Ref :: reference(), + Result :: boolean(). + +await_sched_wall_time_modifications(Ref, Result) -> + sched_wall_time(Ref, erlang:system_info(schedulers)), + Result. + +-spec erlang:gather_sched_wall_time_result(Ref) -> [{pos_integer(), + non_neg_integer(), + non_neg_integer()}] when + Ref :: reference(). + +gather_sched_wall_time_result(Ref) when erlang:is_reference(Ref) -> + sched_wall_time(Ref, erlang:system_info(schedulers), []). + +sched_wall_time(_Ref, 0) -> + ok; +sched_wall_time(Ref, N) -> + receive Ref -> sched_wall_time(Ref, N-1) end. + +sched_wall_time(_Ref, 0, Acc) -> + Acc; +sched_wall_time(Ref, N, undefined) -> + receive {Ref, _} -> sched_wall_time(Ref, N-1, undefined) end; +sched_wall_time(Ref, N, Acc) -> + receive + {Ref, undefined} -> sched_wall_time(Ref, N-1, undefined); + {Ref, SWT} -> sched_wall_time(Ref, N-1, [SWT|Acc]) + end. |