traffic_gen.cc (9719:b67ea6252629) traffic_gen.cc (9720:090935b1b797)
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),
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 elasticReq(p->elastic_req),
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
59 nextTransitionTick(0),
60 nextPacketTick(0),
61 port(name() + ".port", *this),
62 retryPkt(NULL),
63 retryPktTick(0),
64 updateEvent(this),
65 drainManager(NULL)
66{

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

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

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

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

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

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

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

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

--- 32 unchanged lines hidden ---