Project

General

Profile

Revision 6b036b78

ID6b036b78c349a789c989f9575734ffc2afe16eed

Added by Simon Tenbusch over 9 years ago

- added some debug output
- fixed taskheap: made operators static, otherwise the wrong operators would be used
- fixed t_start assignment in scheduleAt

View differences:

src/sim/casyncmodule.cc
84 84
        			"at %s of the scheduling event.",
85 85
        			t.str().c_str(), t_end.str().c_str());
86 86

  
87
        // set the t_start time. Due to internal scheduling issues and state
88
        // keeping, we cannot safely use the arrivalTime() method.
89
        msg->setTstart(t_end + t);
90

  
87 91
        // insert this message in the FES. When the scheduler arrives at this
88 92
        // message it will trigger the processing of the associated task
89 93
        msg->setSentFrom(this, -1, t_end);
src/sim/cscheduler.cc
184 184
    /*
185 185
     * Fill up independent event heap
186 186
     */
187
    printf("length=%i\n", independentEventsHeap.length());
188 187
    while (!(sim->msgQueue.empty()))
189 188
    {
190 189
        msg = sim->msgQueue.removeFirst();
......
240 239
            msg->setBarrier(barrier);
241 240
            // insert user supplied message in task queue.
242 241
            sim->msgQueue.insert(barrier);
243

  
242
            printf("adding to IEH: %s, tend= %f, now First in IEH: ",((cSimpleModule*)sim->getModule(msg->getArrivalModuleId()))->getName(),SIMTIME_DBL(msg->getTend()));
244 243
            independentEventsHeap.insert(msg);
244
            printf("%s\n", ((cSimpleModule*)sim->getModule(independentEventsHeap.peekFirst()->getArrivalModuleId()))->getName());
245

  
245 246
        }
246 247

  
247 248
    }
src/sim/csimulation.cc
715 715
                // then set the module to busy
716 716
                aMod->waitIfBusy();
717 717
                aMod->setBusy();
718
                printf("Offloading: %s\n",mod->getName());
718 719
                barrierMin = threadPool->insertTask(msg, duration, barrierMin);
719 720
            } else {
720 721
                // set the context for sequential execution
721 722
                setContext(mod);
722 723
                setContextType(CTX_EVENT);
723 724
                // take ownership in callHandleMessage after concurrency check
725

  
724 726
                aMod->callHandleMessage(msg);
725 727
            }
726 728

  
src/sim/ctaskheap.cc
39 39

  
40 40
//==========================================================================
41 41

  
42

  
43
inline int operator <= (cMessage& a, cMessage& b)
42
static inline int operator <= (cMessage& a, cMessage& b)
44 43
{
44
    int r = (a.getTend() < b.getTend()) ? 1 :
45
    (a.getTend() > b.getTend()) ? 0 :
46
     a.taskInsertOrder() <= b.taskInsertOrder();
47
    //printf("a=%f,b=%f,r=%i \n",SIMTIME_DBL(a.getTend()),SIMTIME_DBL(b.getTend()),r);
45 48
  return (a.getTend() < b.getTend()) ? 1 :
46 49
         (a.getTend() > b.getTend()) ? 0 :
47 50
          a.taskInsertOrder() <= b.taskInsertOrder();
48 51
}
49 52

  
50
inline int operator > (cMessage& a, cMessage& b)
53
static inline int operator > (cMessage& a, cMessage& b)
51 54
{
52 55
    return !(a<=b);
53 56
}
......
55 58

  
56 59
static int qsort_cmp_msgs(const void *p1, const void *p2)
57 60
{
61
    printf("test");
58 62
    cMessage *m1 = *(cMessage **)p1;
59 63
    cMessage *m2 = *(cMessage **)p2;
60 64

  

Also available in: Unified diff