diff options
author | Micael Karlberg <[email protected]> | 2019-06-25 15:48:16 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-06-26 15:06:16 +0200 |
commit | 67341a69b6593cac1b973354cc25c8f3a564fe2a (patch) | |
tree | 22e09721bd0f858257104a6c4a364dc7af6e1272 /erts/preloaded/src | |
parent | 37338e9876e911d5b019a7f5dda3a7ffc34f8d0b (diff) | |
download | otp-67341a69b6593cac1b973354cc25c8f3a564fe2a.tar.gz otp-67341a69b6593cac1b973354cc25c8f3a564fe2a.tar.bz2 otp-67341a69b6593cac1b973354cc25c8f3a564fe2a.zip |
[esock] Counters for individual sockets
We already had the counters. But we did not entirely handle
counter wrap, especially in related to 'iow' (Inform On Wrap).
There was also no way to get to the counter values, so a socket
specific info function was implemented (piggy back on the existing
"global" info function). And since, we have it, we also add
other info in the returned map (number of readers, writers and
acceptors).
OTP-15818
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/socket.erl | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index e9a76dc1e9..b0f84700a1 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 ]). @@ -879,7 +879,7 @@ on_load(Extra) -> --spec info() -> list(). +-spec info() -> map(). info() -> nif_info(). @@ -904,6 +904,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) -> map() 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 +3897,9 @@ error(Reason) -> nif_info() -> erlang:nif_error(undef). +nif_info(_SRef) -> + erlang:nif_error(undef). + nif_command(_Command) -> erlang:nif_error(undef). |