Project

General

Profile

Revision 96e929a8

ID96e929a8aca87819d829629798726a90312b8093

Added by Simon Tenbusch over 9 years ago

[eefscheduler] encapsulated getProcessingDelay-call in the getEventDuration() of cMessage
The duration of a message is invalidated in scheduleAt and sendDirect/Delayed

View differences:

src/sim/cscheduler.cc
61 61
    //
62 62
    cMessage *msg = sim->msgQueue.removeFirst();
63 63

  
64
    if (msg) {
65
        /*
66
         * Set Duration
67
         */
68
        cSimpleModule* mod = (cSimpleModule*) sim->getModule(msg->getArrivalModuleId());
69
        if (mod->isAsyncModule()) {
70
            msg->setEventDuration(((cAsyncModule*) mod)->getProcessingDelay(msg));
71
        }
72
        /*
73
         * return message
74
         */
75
        return msg;
76
    }
64
    if (msg) return msg;
77 65

  
78 66

  
79 67
    //
......
95 83
    //
96 84
    // If there is a msg now, we return it:
97 85
    //
98
    if (msg) {
99
        /*
100
         * Set Duration
101
         */
102
        cSimpleModule* mod = (cSimpleModule*) sim->getModule(msg->getArrivalModuleId());
103
        if (mod->isAsyncModule()) {
104
            msg->setEventDuration(((cAsyncModule*) mod)->getProcessingDelay(msg));
105
        }
106
        /*
107
         * return message
108
         */
109
        return msg;
110
    }
86
    if (msg) return msg;
111 87

  
112 88
    //
113 89
    // If there is still no message in the queue, there are
......
144 120
    {
145 121
        cAsyncModule* aMod = (cAsyncModule*) mod;
146 122
        simtime_t now = msg->getArrivalTime();
147
        simtime_t duration = aMod->getProcessingDelay(msg);
148
        msg->setEventDuration(duration);
123
        simtime_t duration = msg->getEventDuration();
149 124

  
150 125
        if (aMod->mayParallelize(msg, duration))
151 126
        {
......
191 166
        if (!(mod->isAsyncModule())) {
192 167
            break;
193 168
        }
169

  
194 170
        aMod = (cAsyncModule*) mod;
195
        simtime_t duration = aMod->getProcessingDelay(msg);
196
        msg->setEventDuration(duration);
197
        bool mayPar = aMod->mayParallelize(msg, duration);
171
        simtime_t duration = msg->getEventDuration();
198 172

  
199
        if (!mayPar) {
173
        if (!aMod->mayParallelize(msg, duration)) {
200 174
            break;
201 175
        }
202 176
        /*
......
254 228
    }
255 229
    msg = sim->msgQueue.removeFirst();
256 230

  
257
    //
258
    // If there is a msg now, we return it:
259
    //
260
    if (msg)
261
    return msg;
231
    if (msg) return msg;
262 232

  
263 233
    //
264 234
    // If there is still no message in the queue, there are
......
309 279
        {
310 280
            aMod = (cAsyncModule*) mod;
311 281
            simtime_t now = msg->getArrivalTime();
312
            simtime_t duration = aMod->getProcessingDelay(msg);
313
            msg->setEventDuration(duration);
282
            simtime_t duration = msg->getEventDuration();
314 283

  
315 284
            if (!aMod->mayParallelize(msg, duration))
316 285
            {
......
331 300
            sim->msgQueue.insert(barrier);
332 301

  
333 302
            printf(
334
                     "adding to IEH: %f, tstart=%s, tend= %f, now First in IEH: ", SIMTIME_DBL(msg->getArrivalTime()),
335
                     ((cSimpleModule*) sim->getModule(msg->getArrivalModuleId()))->getName(),
336
                     SIMTIME_DBL(msg->getTend()));
303
                    "adding to IEH: %s, tstart=%f, tend= %f, now First in IEH: ",
304
                    ((cSimpleModule*) sim->getModule(msg->getArrivalModuleId()))->getName(),SIMTIME_DBL(msg->getArrivalTime()),
305
                    SIMTIME_DBL(msg->getTend()));
337 306

  
338 307
            independentEventsHeap.insert(msg);
339 308

  

Also available in: Unified diff