summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2005-11-02 15:29:08 -0500
committerAli Saidi <saidi@eecs.umich.edu>2005-11-02 15:29:08 -0500
commitf0ee50c32fbd7383032cd8d5bc62e002c27f59ef (patch)
treea950c0988d61544d2a2d833bc358d3745e84cb0c
parent36f134786fa0fee9656ccd6c3f2d8e0a84decf26 (diff)
downloadgem5-f0ee50c32fbd7383032cd8d5bc62e002c27f59ef.tar.xz
Don't call Random.uniform() unnecessarily
--HG-- extra : convert_revision : 82b092391f7c866f33ddb028070181038bdce0f8
-rw-r--r--dev/etherlink.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/dev/etherlink.cc b/dev/etherlink.cc
index f5c47bd22..e0f45c3bf 100644
--- a/dev/etherlink.cc
+++ b/dev/etherlink.cc
@@ -159,9 +159,11 @@ EtherLink::Link::transmit(PacketPtr pkt)
DDUMP(EthernetData, pkt->data, pkt->length);
packet = pkt;
- Random<Tick> var;
- Tick delay = (Tick)ceil(((double)pkt->length * ticksPerByte) + 1.0 +
- var.uniform(delayVar));
+ Tick delay = (Tick)ceil(((double)pkt->length * ticksPerByte) + 1.0);
+ if (delayVar != 0) {
+ Random<Tick> var;
+ delay += var.uniform(delayVar);
+ }
DPRINTF(Ethernet, "scheduling packet: delay=%d, (rate=%f)\n",
delay, ticksPerByte);
doneEvent.schedule(curTick + delay);