[hipl-commit] [tiny] Rev 3664: Cache value of highest_descriptor in main loop, increasing overhead.

  • From: Tim Just <tim.just@xxxxxxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Thu, 11 Mar 2010 19:29:10 +0200

Committer: Tim Just <tim.just@xxxxxxxxxxxxxx>
Date: Thu Mar 11 18:28:42 2010 +0100
Revision: 3664
Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: tiny

Log:
  Cache value of highest_descriptor in main loop, increasing overhead.

Modified:
  M  hipd/hipd.c

=== modified file 'hipd/hipd.c'
--- hipd/hipd.c 2010-03-11 16:19:14 +0000
+++ hipd/hipd.c 2010-03-11 17:28:42 +0000
@@ -213,7 +213,7 @@
     int ch, killold = 0;
     // char buff[HIP_MAX_NETLINK_PACKET];
     fd_set read_fdset;
-    int foreground = 1, err = 0, fix_alignment = 0;
+    int foreground = 1, highest_descriptor = 0, err = 0, fix_alignment = 0;
     struct timeval timeout;
     struct hip_packet_context packet_ctx = {0};
 
@@ -326,6 +326,8 @@
 
     HIP_IFEL(create_configs_and_exit, 0, "Configs created, exiting\n");
 
+    highest_descriptor = hip_get_highest_descriptor();
+
     /* Allocate user message. */
     HIP_IFE(!(packet_ctx.input_msg = hip_msg_alloc()), 1);
     packet_ctx.output_msg  = NULL;
@@ -365,7 +367,7 @@
         }
 #endif
 
-        err = select((hip_get_highest_descriptor() + 1), &read_fdset, NULL, 
NULL, &timeout);
+        err = select(highest_descriptor + 1, &read_fdset, NULL, NULL, 
&timeout);
 
         if (err < 0) {
             HIP_ERROR("select() error: %s.\n", strerror(errno));

Other related posts:

  • » [hipl-commit] [tiny] Rev 3664: Cache value of highest_descriptor in main loop, increasing overhead. - Tim Just