Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #94 from satterly/master

Reduce CPU utilisation of gmond running in deaf mode
  • Loading branch information...
commit 80c26e3b65189b369da037a92e2a8d3afbe4856f 2 parents 0ae75b6 + c65f933
@jbuchbinder jbuchbinder authored
Showing with 11 additions and 16 deletions.
  1. +11 −16 gmond/gmond.c
View
27 gmond/gmond.c
@@ -3181,22 +3181,14 @@ void sig_handler(int i)
static void* APR_THREAD_FUNC tcp_listener(apr_thread_t *thd, void *data)
{
apr_time_t now;
- apr_interval_time_t wait = 1000;
+ apr_interval_time_t wait = 100 * 1000; // 100ms
debug_msg("[tcp] Starting TCP listener thread...");
for(;!done;)
{
- if(!deaf)
- {
- now = apr_time_now();
- /* Pull in incoming data */
- poll_tcp_listen_channels(wait, now);
- }
- else
- {
- apr_sleep( wait );
- }
-
+ now = apr_time_now();
+ /* Pull in incoming data */
+ poll_tcp_listen_channels(wait, now);
}
apr_thread_exit(thd, APR_SUCCESS);
@@ -3326,11 +3318,14 @@ main ( int argc, char *argv[] )
udp_last_heard = last_cleanup = next_collection = now = apr_time_now();
/* Create TCP listener thread */
- apr_thread_t *thread;
- if (apr_thread_create(&thread, NULL, tcp_listener, NULL, global_context) != APR_SUCCESS)
+ if(!deaf)
{
- err_msg("Failed to create TCP listener thread. Exiting.\n");
- exit(1);
+ apr_thread_t *thread;
+ if (apr_thread_create(&thread, NULL, tcp_listener, NULL, global_context) != APR_SUCCESS)
+ {
+ err_msg("Failed to create TCP listener thread. Exiting.\n");
+ exit(1);
+ }
}
/* Loop */
Please sign in to comment.
Something went wrong with that request. Please try again.