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.6.0~24 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=65da3cc731c72486d53d58c9b080f235121177d9;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 --- diff --git a/src/bin/lttng-sessiond/agent-thread.c b/src/bin/lttng-sessiond/agent-thread.c index 274b94998..eae99a31c 100644 --- a/src/bin/lttng-sessiond/agent-thread.c +++ b/src/bin/lttng-sessiond/agent-thread.c @@ -306,12 +306,14 @@ void *agent_thread_manage_registration(void *data) } while (1) { - DBG3("[agent-thread] Manage agent polling on %d fds", + DBG3("[agent-thread] Manage agent polling", LTTNG_POLL_GETNB(&events)); /* Inifinite blocking call, waiting for transmission */ restart: ret = lttng_poll_wait(&events, -1); + DBG3("[agent-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/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/main.c b/src/bin/lttng-sessiond/main.c index 27dc98188..48868820e 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -1002,12 +1002,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) { /* @@ -1470,12 +1472,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 72c5f3426..129203fa5 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -2189,9 +2189,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) { @@ -2764,9 +2767,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) {