aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-04-25 17:51:31 +0200
committerLukas Larsson <[email protected]>2017-09-15 10:04:59 +0200
commit23f09f3bbeb924b44fbcef882b1f0c24e90626bc (patch)
tree2d113d52f77ddae6a392ac99b25e501938cc6354
parent7b0c3b7e51bf6b13c95565c99cd80191525295e1 (diff)
downloadotp-23f09f3bbeb924b44fbcef882b1f0c24e90626bc.tar.gz
otp-23f09f3bbeb924b44fbcef882b1f0c24e90626bc.tar.bz2
otp-23f09f3bbeb924b44fbcef882b1f0c24e90626bc.zip
erts: Add number of enif_select's to check_io_debug
-rw-r--r--erts/emulator/beam/erl_bif_info.c6
-rw-r--r--erts/emulator/beam/sys.h1
-rw-r--r--erts/emulator/sys/common/erl_check_io.c7
-rw-r--r--erts/emulator/test/driver_SUITE.erl5
4 files changed, 15 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index 3b6e83c242..c782d7a8ce 100644
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -3574,13 +3574,15 @@ BIF_RETTYPE erts_debug_get_internal_state_1(BIF_ALIST_1)
szp = &sz;
hpp = NULL;
while (1) {
- res = erts_bld_tuple(hpp, szp, 3,
+ res = erts_bld_tuple(hpp, szp, 4,
erts_bld_uint(hpp, szp,
(Uint) no_errors),
erts_bld_uint(hpp, szp,
(Uint) ciodi.no_used_fds),
erts_bld_uint(hpp, szp,
- (Uint) ciodi.no_driver_select_structs));
+ (Uint) ciodi.no_driver_select_structs),
+ erts_bld_uint(hpp, szp,
+ (Uint) ciodi.no_enif_select_structs));
if (hpp)
break;
hp = HAlloc(BIF_P, sz);
diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h
index e2a21c0ecd..0bf2ecfc8b 100644
--- a/erts/emulator/beam/sys.h
+++ b/erts/emulator/beam/sys.h
@@ -790,6 +790,7 @@ void fini_getenv_state(GETENV_STATE *);
typedef struct {
int no_used_fds;
int no_driver_select_structs;
+ int no_enif_select_structs;
} ErtsCheckIoDebugInfo;
int erts_check_io_debug(ErtsCheckIoDebugInfo *ip);
diff --git a/erts/emulator/sys/common/erl_check_io.c b/erts/emulator/sys/common/erl_check_io.c
index cd695e236f..15662f9a70 100644
--- a/erts/emulator/sys/common/erl_check_io.c
+++ b/erts/emulator/sys/common/erl_check_io.c
@@ -2368,6 +2368,7 @@ typedef struct {
int used_fds;
int num_errors;
int no_driver_select_structs;
+ int no_enif_select_structs;
#ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS
int internal_fds;
ErtsPollEvents *epep;
@@ -2392,6 +2393,8 @@ static void doit_erts_check_io_debug(void *vstate, void *vcounters)
if (state->driver.select)
counters->no_driver_select_structs++;
+ if (state->driver.nif)
+ counters->no_enif_select_structs++;
#ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS
if (state->events || ep_events) {
@@ -2614,6 +2617,7 @@ ERTS_CIO_EXPORT(erts_check_io_debug)(ErtsCheckIoDebugInfo *ciodip)
ErtsDrvEventState null_des;
null_des.driver.select = NULL;
+ null_des.driver.nif = NULL;
null_des.driver.stop.drv_ptr = NULL;
null_des.events = 0;
null_des.remove_cnt = 0;
@@ -2636,6 +2640,7 @@ ERTS_CIO_EXPORT(erts_check_io_debug)(ErtsCheckIoDebugInfo *ciodip)
counters.used_fds = 0;
counters.num_errors = 0;
counters.no_driver_select_structs = 0;
+ counters.no_enif_select_structs = 0;
#ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS
len = erts_atomic_read_nob(&drv_ev_state_len);
@@ -2654,10 +2659,12 @@ ERTS_CIO_EXPORT(erts_check_io_debug)(ErtsCheckIoDebugInfo *ciodip)
ciodip->no_used_fds = counters.used_fds;
ciodip->no_driver_select_structs = counters.no_driver_select_structs;
+ ciodip->no_enif_select_structs = counters.no_enif_select_structs;
erts_printf("\n");
erts_printf("used fds=%d\n", counters.used_fds);
erts_printf("Number of driver_select() structures=%d\n", counters.no_driver_select_structs);
+ erts_printf("Number of enif_select() structures=%d\n", counters.no_enif_select_structs);
#ifdef ERTS_SYS_CONTINOUS_FD_NUMBERS
erts_printf("internal fds=%d\n", counters.internal_fds);
#endif
diff --git a/erts/emulator/test/driver_SUITE.erl b/erts/emulator/test/driver_SUITE.erl
index 3dffe0902c..c6d7f708be 100644
--- a/erts/emulator/test/driver_SUITE.erl
+++ b/erts/emulator/test/driver_SUITE.erl
@@ -2258,8 +2258,8 @@ z_test(Config) when is_list(Config) ->
check_io_debug() ->
get_stable_check_io_info(),
- {NoErrorFds, NoUsedFds, NoDrvSelStructs} = CheckIoDebug
- = erts_debug:get_internal_state(check_io_debug),
+ {NoErrorFds, NoUsedFds, NoDrvSelStructs, NoEnifSelStructs}
+ = CheckIoDebug = erts_debug:get_internal_state(check_io_debug),
HasGetHost = has_gethost(),
ct:log("check_io_debug: ~p~n"
"HasGetHost: ~p",[CheckIoDebug, HasGetHost]),
@@ -2272,6 +2272,7 @@ check_io_debug() ->
%% one extra used fd that is not selected on
ok
end,
+ 0 = NoEnifSelStructs,
ok.
has_gethost() ->