Skip to content

Commit

Permalink
cpu: Don't count data if send failed in TrafficGen
Browse files Browse the repository at this point in the history
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
andysan committed Mar 18, 2013
1 parent 12f912f commit 700092c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/cpu/testers/traffic_gen/traffic_gen.cc
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 700092c

Please sign in to comment.