Don't call Random.uniform() unnecessarily
--HG-- extra : convert_revision : 82b092391f7c866f33ddb028070181038bdce0f8
This commit is contained in:
parent
36f134786f
commit
f0ee50c32f
1 changed files with 5 additions and 3 deletions
|
@ -159,9 +159,11 @@ EtherLink::Link::transmit(PacketPtr pkt)
|
||||||
DDUMP(EthernetData, pkt->data, pkt->length);
|
DDUMP(EthernetData, pkt->data, pkt->length);
|
||||||
|
|
||||||
packet = pkt;
|
packet = pkt;
|
||||||
Random<Tick> var;
|
Tick delay = (Tick)ceil(((double)pkt->length * ticksPerByte) + 1.0);
|
||||||
Tick delay = (Tick)ceil(((double)pkt->length * ticksPerByte) + 1.0 +
|
if (delayVar != 0) {
|
||||||
var.uniform(delayVar));
|
Random<Tick> var;
|
||||||
|
delay += var.uniform(delayVar);
|
||||||
|
}
|
||||||
DPRINTF(Ethernet, "scheduling packet: delay=%d, (rate=%f)\n",
|
DPRINTF(Ethernet, "scheduling packet: delay=%d, (rate=%f)\n",
|
||||||
delay, ticksPerByte);
|
delay, ticksPerByte);
|
||||||
doneEvent.schedule(curTick + delay);
|
doneEvent.schedule(curTick + delay);
|
||||||
|
|
Loading…
Reference in a new issue