Permalink
Browse files

cpu: Don't count data if send failed in TrafficGen

Use the return value of send() to determine if a memory request was
unsuccessful. In that case, don't update the dataManipulated counter
(used to stop generating requests after a fixed amount of data has
been touched) and don't advance the linear generator to the next
address.
  • Loading branch information...
1 parent 87fa4ac commit 68b9e6a2057cf399d3fd1de2b9e0629480527962 @andysan committed Mar 15, 2013
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/cpu/testers/traffic_gen/traffic_gen.cc
@@ -427,13 +427,13 @@ TrafficGen::StateGraph::LinearGen::execute()
DPRINTF(TrafficGen, "LinearGen::execute: %c to addr %x, size %d\n",
isRead ? 'r' : 'w', nextAddr, blocksize);
- send(nextAddr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq);
+ if (send(nextAddr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq)) {
+ // increment the address
+ nextAddr += blocksize;
- // increment the address
- nextAddr += blocksize;
-
- // Add the amount of data manipulated to the total
- dataManipulated += blocksize;
+ // Add the amount of data manipulated to the total
+ dataManipulated += blocksize;
+ }
}
Tick
@@ -495,10 +495,10 @@ TrafficGen::StateGraph::RandomGen::execute()
isRead ? 'r' : 'w', addr, blocksize);
// send a new request packet
- send(addr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq);
-
- // Add the amount of data manipulated to the total
- dataManipulated += blocksize;
+ if (send(addr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq)) {
+ // Add the amount of data manipulated to the total
+ dataManipulated += blocksize;
+ }
}
Tick

0 comments on commit 68b9e6a

Please sign in to comment.