aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-05-30 16:35:18 +0200
committerLukas Larsson <[email protected]>2017-10-02 10:35:52 +0200
commit988f5f5e8061ce2e135a314ca782788eda478a06 (patch)
tree1609c42abb9ed03a176865ee32ad3de803c392d3 /erts/emulator/test
parent1f9003a3dd9bbf9e3dcd84b8fdecef04a3b5e9c7 (diff)
downloadotp-988f5f5e8061ce2e135a314ca782788eda478a06.tar.gz
otp-988f5f5e8061ce2e135a314ca782788eda478a06.tar.bz2
otp-988f5f5e8061ce2e135a314ca782788eda478a06.zip
erts: Move all I/O polling to a seperate thread
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/driver_SUITE.erl49
-rw-r--r--erts/emulator/test/driver_SUITE_data/chkio_drv.c3
2 files changed, 36 insertions, 16 deletions
diff --git a/erts/emulator/test/driver_SUITE.erl b/erts/emulator/test/driver_SUITE.erl
index 332d11345b..0e691b0c80 100644
--- a/erts/emulator/test/driver_SUITE.erl
+++ b/erts/emulator/test/driver_SUITE.erl
@@ -136,7 +136,7 @@ suite() ->
{timetrap, {minutes, 1}}].
all() -> %% Keep a_test first and z_test last...
- [a_test, outputv_errors, outputv_echo, queue_echo, {group, timer},
+ [a_test, outputv_errors, outputv_echo, queue_echo, %{group, timer},
driver_unloaded, io_ready_exit, use_fallback_pollset,
bad_fd_in_pollset, fd_change,
steal_control, otp_6602, driver_system_info_base_ver,
@@ -785,12 +785,9 @@ io_ready_exit(Config) when is_list(Config) ->
use_fallback_pollset(Config) when is_list(Config) ->
FlbkFun = fun () ->
- ChkIoDuring = get_check_io_total(erlang:system_info(check_io)),
- case lists:keysearch(fallback_poll_set_size,
- 1,
- ChkIoDuring) of
- {value,
- {fallback_poll_set_size, N}} when N > 0 ->
+ {Flbk, _} = get_fallback(erlang:system_info(check_io)),
+ case lists:keysearch(total_poll_set_size, 1, Flbk) of
+ {value, {total_poll_set_size, N}} when N > 0 ->
ok;
Error ->
ct:fail({failed_to_use_fallback, Error})
@@ -1013,14 +1010,15 @@ get_stable_check_io_info() ->
%% Merge return from erlang:system_info(check_io)
%% as if it was one big pollset.
get_check_io_total(ChkIo) ->
- lists:foldl(fun(Pollset, Acc) ->
- lists:zipwith(fun(A, B) ->
- add_pollset_infos(A,B)
- end,
- Pollset, Acc)
- end,
- hd(ChkIo),
- tl(ChkIo)).
+ {Fallback, Rest} = get_fallback(ChkIo),
+ add_fallback_infos(Fallback,
+ lists:foldl(fun(Pollset, Acc) ->
+ lists:zipwith(fun(A, B) ->
+ add_pollset_infos(A,B)
+ end,
+ Pollset, Acc)
+ end,
+ hd(Rest), tl(Rest))).
add_pollset_infos({Tag, A}=TA , {Tag, B}=TB) ->
case tag_type(Tag) of
@@ -1035,13 +1033,32 @@ add_pollset_infos({Tag, A}=TA , {Tag, B}=TB) ->
end
end.
+get_fallback([MaybeFallback | ChkIo] = AllChkIo) ->
+ case proplists:get_value(fallback, MaybeFallback) of
+ true ->
+ {MaybeFallback, ChkIo};
+ false ->
+ {undefined, AllChkIo}
+ end.
+
+add_fallback_infos(undefined, Acc) ->
+ Acc;
+add_fallback_infos(Flbk, Acc) ->
+ lists:zipwith(fun({Tag, A}=TA, {Tag, B}=TB) ->
+ case tag_type(Tag) of
+ sum -> {Tag, A + B};
+ const when Tag =:= fallback -> TA;
+ const -> TB
+ end
+ end,
+ Flbk, Acc).
+
tag_type(name) -> const;
tag_type(primary) -> const;
tag_type(fallback) -> const;
tag_type(kernel_poll) -> const;
tag_type(memory_size) -> sum;
tag_type(total_poll_set_size) -> sum;
-tag_type(fallback_poll_set_size) -> sum;
tag_type(lazy_updates) -> const;
tag_type(pending_updates) -> sum;
tag_type(batch_updates) -> const;
diff --git a/erts/emulator/test/driver_SUITE_data/chkio_drv.c b/erts/emulator/test/driver_SUITE_data/chkio_drv.c
index 5167036602..d548c4b1dc 100644
--- a/erts/emulator/test/driver_SUITE_data/chkio_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/chkio_drv.c
@@ -511,6 +511,9 @@ chkio_drv_ready_input(ErlDrvData drv_data, ErlDrvEvent event)
driver_failure_atom(cddp->port, "input_fd_not_found");
break;
}
+ case CHKIO_FD_CHANGE:
+ /* This may be triggered when an fd is closed while being selected on. */
+ break;
case CHKIO_STEAL:
break;
case CHKIO_STEAL_AUX: