Deleted Added
sdiff udiff text old ( 9719:b67ea6252629 ) new ( 9720:090935b1b797 )
full compact
1/*
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 41 unchanged lines hidden (view full) ---

50
51using namespace std;
52
53TrafficGen::TrafficGen(const TrafficGenParams* p)
54 : MemObject(p),
55 system(p->system),
56 masterID(system->getMasterId(name())),
57 configFile(p->config_file),
58 nextTransitionTick(0),
59 nextPacketTick(0),
60 port(name() + ".port", *this),
61 retryPkt(NULL),
62 retryPktTick(0),
63 updateEvent(this),
64 drainManager(NULL)
65{

--- 36 unchanged lines hidden (view full) ---

102}
103
104void
105TrafficGen::initState()
106{
107 // when not restoring from a checkpoint, make sure we kick things off
108 if (system->isTimingMode()) {
109 // call nextPacketTick on the state to advance it
110 nextPacketTick = states[currState]->nextPacketTick();
111 schedule(updateEvent, std::min(nextPacketTick, nextTransitionTick));
112 } else {
113 DPRINTF(TrafficGen,
114 "Traffic generator is only active in timing mode\n");
115 }
116}
117
118unsigned int

--- 41 unchanged lines hidden (view full) ---

160 }
161
162 UNSERIALIZE_SCALAR(nextTransitionTick);
163
164 UNSERIALIZE_SCALAR(nextPacketTick);
165
166 // @todo In the case of a stateful generator state such as the
167 // trace player we would also have to restore the position in the
168 // trace playback
169 UNSERIALIZE_SCALAR(currState);
170}
171
172void
173TrafficGen::update()
174{
175 // if we have reached the time for the next state transition, then
176 // perform the transition

--- 11 unchanged lines hidden (view full) ---

188 }
189
190 // if we are waiting for a retry, do not schedule any further
191 // events, in the case of a transition or a successful send, go
192 // ahead and determine when the next update should take place
193 if (retryPkt == NULL) {
194 // schedule next update event based on either the next execute
195 // tick or the next transition, which ever comes first
196 nextPacketTick = states[currState]->nextPacketTick();
197 Tick nextEventTick = std::min(nextPacketTick, nextTransitionTick);
198 DPRINTF(TrafficGen, "Next event scheduled at %lld\n", nextEventTick);
199 schedule(updateEvent, nextEventTick);
200 }
201}
202
203void
204TrafficGen::parseConfig()

--- 176 unchanged lines hidden (view full) ---

381
382 DPRINTF(TrafficGen, "Received retry\n");
383 numRetries++;
384 // attempt to send the packet, and if we are successful start up
385 // the machinery again
386 if (port.sendTimingReq(retryPkt)) {
387 retryPkt = NULL;
388 // remember how much delay was incurred due to back-pressure
389 // when sending the request
390 Tick delay = curTick() - retryPktTick;
391 retryPktTick = 0;
392 retryTicks += delay;
393
394 if (drainManager == NULL) {
395 // packet is sent, so find out when the next one is due
396 nextPacketTick = states[currState]->nextPacketTick();
397 Tick nextEventTick = std::min(nextPacketTick, nextTransitionTick);
398 schedule(updateEvent, std::max(curTick(), nextEventTick));
399 } else {
400 // shut things down
401 nextPacketTick = MaxTick;
402 nextTransitionTick = MaxTick;
403 drainManager->signalDrainDone();
404 // Clear the drain event once we're done with it.

--- 32 unchanged lines hidden ---