From f0ee50c32fbd7383032cd8d5bc62e002c27f59ef Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Wed, 2 Nov 2005 15:29:08 -0500 Subject: Don't call Random.uniform() unnecessarily --HG-- extra : convert_revision : 82b092391f7c866f33ddb028070181038bdce0f8 --- dev/etherlink.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'dev') 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); -- cgit v1.2.3