diff options
author | Micael Karlberg <[email protected]> | 2019-07-08 16:41:28 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-07-08 16:41:28 +0200 |
commit | 1e2343e748ba212536a568a5d40357d75ccb6b7a (patch) | |
tree | 17d7e6702b4bd39887d4c78a4fcfbf09e73d312d /erts/preloaded/src | |
parent | f8bd1d27e86b338693b72fd1bd6938876660dfcf (diff) | |
parent | a492dd84c72ca8bad5e9a52e658c9448643a9cfe (diff) | |
download | otp-1e2343e748ba212536a568a5d40357d75ccb6b7a.tar.gz otp-1e2343e748ba212536a568a5d40357d75ccb6b7a.tar.bz2 otp-1e2343e748ba212536a568a5d40357d75ccb6b7a.zip |
Merge branch 'bmk/erts/esock/20190626/finalize_counters/OTP-15818' into maint
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/socket.erl | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index e9a76dc1e9..be94e3a867 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -31,7 +31,7 @@ debug/1, %% command/1, - info/0, + info/0, info/1, supports/0, supports/1, supports/2, supports/3 ]). @@ -67,6 +67,10 @@ select_ref/0, select_info/0, + socket_counters/0, + socket_counter/0, + socket_info/0, + %% command/0, domain/0, @@ -153,6 +157,15 @@ }. %% -type command() :: debug_command(). +-type socket_counters() :: [{socket_counter(), non_neg_integer()}]. +-type socket_counter() :: read_byte | read_fails | read_pkg | read_tries | + read_waits | write_byte | write_fails | write_pkg | + write_tries | write_waits. +-type socket_info() :: #{counters := socket_counters(), + num_readers := non_neg_integer(), + num_writers := non_neg_integer(), + num_acceptors := non_neg_integer()}. + -type uint8() :: 0..16#FF. -type uint16() :: 0..16#FFFF. -type uint20() :: 0..16#FFFFF. @@ -879,7 +892,7 @@ on_load(Extra) -> --spec info() -> list(). +-spec info() -> map(). info() -> nif_info(). @@ -904,6 +917,24 @@ command(#{command := debug, %% =========================================================================== %% +%% info - Get miscellaneous information about a socket. +%% +%% Generates a list of various info about the socket, such as counter values. +%% +%% Do *not* call this function often. +%% +%% =========================================================================== + +-spec info(Socket) -> socket_info() when + Socket :: socket(). + +info(#socket{ref = SockRef}) -> + nif_info(SockRef). + + + +%% =========================================================================== +%% %% supports - get information about what the platform "supports". %% %% Generates a list of various info about what the plaform can support. @@ -3879,6 +3910,9 @@ error(Reason) -> nif_info() -> erlang:nif_error(undef). +nif_info(_SRef) -> + erlang:nif_error(undef). + nif_command(_Command) -> erlang:nif_error(undef). |