tport.cc (4626:ed8aacb19c03) | tport.cc (4666:5d110d024fcf) |
---|---|
1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 77 unchanged lines hidden (view full) --- 86 87 88void 89SimpleTimingPort::schedSendTiming(PacketPtr pkt, Tick when) 90{ 91 assert(when > curTick); 92 93 // Nothing is on the list: add it and schedule an event | 1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 77 unchanged lines hidden (view full) --- 86 87 88void 89SimpleTimingPort::schedSendTiming(PacketPtr pkt, Tick when) 90{ 91 assert(when > curTick); 92 93 // Nothing is on the list: add it and schedule an event |
94 if (transmitList.empty()) { 95 assert(!sendEvent->scheduled()); 96 sendEvent->schedule(when); 97 transmitList.push_back(DeferredPacket(when, pkt)); | 94 if (transmitList.empty() || when < transmitList.front().tick) { 95 transmitList.push_front(DeferredPacket(when, pkt)); 96 schedSendEvent(when); |
98 return; 99 } 100 | 97 return; 98 } 99 |
101 // something is on the list and this belongs at the end | 100 // list is non-empty and this is not the head, so event should 101 // already be scheduled 102 assert(waitingOnRetry || 103 (sendEvent->scheduled() && sendEvent->when() <= when)); 104 105 // list is non-empty & this belongs at the end |
102 if (when >= transmitList.back().tick) { 103 transmitList.push_back(DeferredPacket(when, pkt)); 104 return; 105 } | 106 if (when >= transmitList.back().tick) { 107 transmitList.push_back(DeferredPacket(when, pkt)); 108 return; 109 } |
106 // Something is on the list and this belongs somewhere else | 110 111 // this belongs in the middle somewhere |
107 DeferredPacketIterator i = transmitList.begin(); | 112 DeferredPacketIterator i = transmitList.begin(); |
113 i++; // already checked for insertion at front |
|
108 DeferredPacketIterator end = transmitList.end(); 109 110 for (; i != end; ++i) { 111 if (when < i->tick) { | 114 DeferredPacketIterator end = transmitList.end(); 115 116 for (; i != end; ++i) { 117 if (when < i->tick) { |
112 if (i == transmitList.begin()) { 113 //Inserting at begining, reschedule 114 sendEvent->reschedule(when); 115 } | |
116 transmitList.insert(i, DeferredPacket(when, pkt)); 117 return; 118 } 119 } 120 assert(false); // should never get here 121} 122 123 --- 53 unchanged lines hidden --- | 118 transmitList.insert(i, DeferredPacket(when, pkt)); 119 return; 120 } 121 } 122 assert(false); // should never get here 123} 124 125 --- 53 unchanged lines hidden --- |