From: Ali Saidi Date: Wed, 2 Nov 2005 20:29:08 +0000 (-0500) Subject: Don't call Random.uniform() unnecessarily X-Git-Tag: m5_2.0_beta1~315 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f0ee50c32fbd7383032cd8d5bc62e002c27f59ef;p=gem5.git Don't call Random.uniform() unnecessarily --HG-- extra : convert_revision : 82b092391f7c866f33ddb028070181038bdce0f8 --- 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 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 var; + delay += var.uniform(delayVar); + } DPRINTF(Ethernet, "scheduling packet: delay=%d, (rate=%f)\n", delay, ticksPerByte); doneEvent.schedule(curTick + delay);