[pisa-src] r1120 - trunk/pisacd

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Tue, 13 Oct 2009 16:21:57 +0200

Author: tjansen
Date: Tue Oct 13 16:21:57 2009
New Revision: 1120

Log:
Switched cdpending to the scheduler.

Please note that this is still work in progress, though at this point of time
the bottleneck of linking the number of calls to the pending code and the
number of packets received is removed. gprof should be happy.

Modified:
   trunk/pisacd/cdmain.c
   trunk/pisacd/cdpending.c
   trunk/pisacd/cdpending.h

Modified: trunk/pisacd/cdmain.c
==============================================================================
--- trunk/pisacd/cdmain.c       Tue Oct 13 16:19:53 2009        (r1119)
+++ trunk/pisacd/cdmain.c       Tue Oct 13 16:21:57 2009        (r1120)
@@ -264,6 +264,7 @@
        pisa_sched_init(&cd_ctx.scheduler);
        pisa_sched_add_now(pisa_maintenance_test, NULL);
        pisa_sched_add_now(pisa_task_heartbeat, NULL);
+       pisa_sched_add_now(pisa_task_pending, NULL);
 }
 
 static void cd_deinit(void)
@@ -430,8 +431,6 @@
 
                if (cd_ctx.scheduler)
                        pisa_sched_run();
-
-               pending = pisa_pending_update();
        }
 }
 

Modified: trunk/pisacd/cdpending.c
==============================================================================
--- trunk/pisacd/cdpending.c    Tue Oct 13 16:19:53 2009        (r1119)
+++ trunk/pisacd/cdpending.c    Tue Oct 13 16:21:57 2009        (r1120)
@@ -15,6 +15,7 @@
 #include "debug.h"
 #include "cdpending.h"
 #include "util.h"
+#include "scheduler.h"
 
 /**
  * Adds a number of microseconds to a timeval.
@@ -156,17 +157,16 @@
        }
 }
 
-
 /**
  * Walk through the hash of pending requests and see if they need to be
  * processed. If they are due, check that we don't exceed the maximal number
  * of resends.
  * @return 1 if requests are pending, 0 if no requests are pending
  */
-int pisa_pending_update(void)
+void pisa_task_pending(void *data)
 {
        pisa_pending *p = hash_pending;
-       struct timeval t;
+       struct timeval t, delay = {0, 10000};
        gettimeofday(&t, NULL);
 
        while (p) {
@@ -187,5 +187,7 @@
                }
        }
 
-       return hash_pending ? 1 : 0;
+       pisa_sched_add(pisa_task_pending, &delay, NULL);
+
+       /* return hash_pending ? 1 : 0; */
 }

Modified: trunk/pisacd/cdpending.h
==============================================================================
--- trunk/pisacd/cdpending.h    Tue Oct 13 16:19:53 2009        (r1119)
+++ trunk/pisacd/cdpending.h    Tue Oct 13 16:21:57 2009        (r1120)
@@ -43,6 +43,6 @@
 void pisa_pending_remove(pisa_pending *pend);
 void pisa_pending_remove_all(void);
 void pisa_pending_remove_by_entry(pisa_conmgr_entry *entry);
-int pisa_pending_update(void);
+void pisa_task_pending(void *data);
 
 #endif /* PISA_CDPENDING_H */

Other related posts:

  • » [pisa-src] r1120 - trunk/pisacd - Thomas Jansen