Fixed rbed scheduler code to still work in schedsim.
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Fri, 21 Nov 2014 17:55:27 +0000 (18:55 +0100)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Fri, 21 Nov 2014 17:55:33 +0000 (18:55 +0100)
kernel/schedule_rbed.c
tools/schedsim/simulator.c

index 291504a..11245b4 100644 (file)
@@ -59,8 +59,8 @@
 #       include <trace/trace.h>
 #       include <trace_definitions/trace_defs.h>
 #       include <timer.h> // update_sched_timer
+#       include <kcb.h>
 #endif
-#include <kcb.h>
 
 #define SPECTRUM        1000000
 
@@ -316,6 +316,7 @@ struct dcb *schedule(void)
  start_over:
     todisp = kcb_current->queue_head;
 
+#ifndef SCHEDULER_SIMULATOR
 #define PRINT_NAME(d) \
     do { \
         if (!(d) || !(d)->disp) { \
@@ -327,6 +328,9 @@ struct dcb *schedule(void)
         debug(SUBSYS_DISPATCH, "looking at '%s', release_time=%lu, kernel_now=%zu\n", \
                 dst->name, d->release_time, kernel_now); \
     }while(0)
+#else
+#define PRINT_NAME(d) do{}while(0)
+#endif
 
     // Skip over all tasks released in the future, they're technically not
     // in the schedule yet. We just have them to reduce book-keeping.
@@ -338,7 +342,9 @@ struct dcb *schedule(void)
 
     // nothing to dispatch
     if(todisp == NULL) {
+#ifndef SCHEDULER_SIMULATOR
         debug(SUBSYS_DISPATCH, "schedule: no dcb runnable\n");
+#endif
         lastdisp = NULL;
         return NULL;
     }
@@ -554,6 +560,7 @@ void scheduler_yield(struct dcb *dcb)
     queue_insert(dcb);
 }
 
+#ifndef SCHEDULER_SIMULATOR
 void scheduler_reset_time(void)
 {
     trace_event(TRACE_SUBSYS_KERNEL, TRACE_EVENT_KERNEL_TIMER_SYNC, 0);
@@ -615,3 +622,4 @@ void scheduler_restore_state(void)
     // clear time slices
     scheduler_reset_time();
 }
+#endif
index cf68141..32206e9 100644 (file)
@@ -68,6 +68,14 @@ struct dcb {
     struct dispatcher_shared_generic dsg;
 };
 
+struct kcb {
+    struct kcb *prev, *next;
+    struct dcb *queue_head, *queue_tail;
+    unsigned int u_hrt, u_srt, w_be, n_be;
+} curr;
+struct kcb *kcb_current = &curr;
+
+
 static void panic(const char *msg, ...)
 {
     va_list ap;