From: Mathieu Desnoyers Date: Mon, 5 Jan 2015 21:43:07 +0000 (-0500) Subject: Fix: poll: show the correct number of fds X-Git-Tag: v2.4.4~21 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ec4c7666d3907424f62e874b78e44ce4b9456f41;p=lttng-tools.git Fix: poll: show the correct number of fds LTTNG_POLL_GETNB() uses wait nb_fd, which is only updated after lttng_poll_wait returns. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau Conflicts: src/bin/lttng-sessiond/ht-cleanup.c Conflicts: src/bin/lttng-sessiond/jul-thread.c --- diff --git a/src/bin/lttng-sessiond/ht-cleanup.c b/src/bin/lttng-sessiond/ht-cleanup.c index f343d620b..57d6aec11 100644 --- a/src/bin/lttng-sessiond/ht-cleanup.c +++ b/src/bin/lttng-sessiond/ht-cleanup.c @@ -60,13 +60,14 @@ void *thread_ht_cleanup(void *data) health_code_update(); while (1) { - DBG3("[ht-thread] Polling on %d fds.", - LTTNG_POLL_GETNB(&events)); + DBG3("[ht-thread] Polling."); /* Inifinite blocking call, waiting for transmission */ restart: health_poll_entry(); ret = lttng_poll_wait(&events, -1); + DBG3("[ht-thread] Returning from poll on %d fds.", + LTTNG_POLL_GETNB(&events)); health_poll_exit(); if (ret < 0) { /* diff --git a/src/bin/lttng-sessiond/jul-thread.c b/src/bin/lttng-sessiond/jul-thread.c index ad9f9f49f..4a6fc2a84 100644 --- a/src/bin/lttng-sessiond/jul-thread.c +++ b/src/bin/lttng-sessiond/jul-thread.c @@ -282,12 +282,13 @@ void *jul_thread_manage_registration(void *data) } while (1) { - DBG3("[jul-thread] Manage JUL polling on %d fds", - LTTNG_POLL_GETNB(&events)); + DBG3("[jul-thread] Manage JUL polling"); /* Inifinite blocking call, waiting for transmission */ restart: ret = lttng_poll_wait(&events, -1); + DBG3("[jul-thread] Manage agent return from poll on %d fds", + LTTNG_POLL_GETNB(&events)); if (ret < 0) { /* * Restart interrupted system call. diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index c7beed55d..9b3828bd0 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -914,12 +914,14 @@ static void *thread_manage_kernel(void *data) update_poll_flag = 0; } - DBG("Thread kernel polling on %d fds", LTTNG_POLL_GETNB(&events)); + DBG("Thread kernel polling"); /* Poll infinite value of time */ restart: health_poll_entry(); ret = lttng_poll_wait(&events, -1); + DBG("Thread kernel return from poll on %d fds", + LTTNG_POLL_GETNB(&events)); health_poll_exit(); if (ret < 0) { /* @@ -1382,12 +1384,14 @@ static void *thread_manage_apps(void *data) health_code_update(); while (1) { - DBG("Apps thread polling on %d fds", LTTNG_POLL_GETNB(&events)); + DBG("Apps thread polling"); /* Inifinite blocking call, waiting for transmission */ restart: health_poll_entry(); ret = lttng_poll_wait(&events, -1); + DBG("Apps thread return from poll on %d fds", + LTTNG_POLL_GETNB(&events)); health_poll_exit(); if (ret < 0) { /* diff --git a/src/bin/lttng-sessiond/ust-thread.c b/src/bin/lttng-sessiond/ust-thread.c index d0ea32480..35f82e391 100644 --- a/src/bin/lttng-sessiond/ust-thread.c +++ b/src/bin/lttng-sessiond/ust-thread.c @@ -64,13 +64,14 @@ void *ust_thread_manage_notify(void *data) health_code_update(); while (1) { - DBG3("[ust-thread] Manage notify polling on %d fds", - LTTNG_POLL_GETNB(&events)); + DBG3("[ust-thread] Manage notify polling"); /* Inifinite blocking call, waiting for transmission */ restart: health_poll_entry(); ret = lttng_poll_wait(&events, -1); + DBG3("[ust-thread] Manage notify return from poll on %d fds", + LTTNG_POLL_GETNB(&events)); health_poll_exit(); if (ret < 0) { /* diff --git a/src/common/consumer.c b/src/common/consumer.c index aec7ba693..6754cee67 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -2188,9 +2188,12 @@ void *consumer_thread_metadata_poll(void *data) } restart: - DBG("Metadata poll wait with %d fd(s)", LTTNG_POLL_GETNB(&events)); + health_code_update(); health_poll_entry(); + DBG("Metadata poll wait"); ret = lttng_poll_wait(&events, -1); + DBG("Metadata poll return from wait with %d fd(s)", + LTTNG_POLL_GETNB(&events)); health_poll_exit(); DBG("Metadata event catched in thread"); if (ret < 0) { @@ -2763,9 +2766,12 @@ void *consumer_thread_channel_poll(void *data) } restart: - DBG("Channel poll wait with %d fd(s)", LTTNG_POLL_GETNB(&events)); + health_code_update(); + DBG("Channel poll wait"); health_poll_entry(); ret = lttng_poll_wait(&events, -1); + DBG("Channel poll return from wait with %d fd(s)", + LTTNG_POLL_GETNB(&events)); health_poll_exit(); DBG("Channel event catched in thread"); if (ret < 0) {