From: Lucas Schnorr Date: Tue, 20 Sep 2011 12:35:32 +0000 (+0200) Subject: [ns3, trace] tracing needs the sentBytes variable being updated by the datasent callback X-Git-Tag: v3_6_2~74 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7d089b0784964a16c533478390f02dbcc02167ab [ns3, trace] tracing needs the sentBytes variable being updated by the datasent callback --- diff --git a/examples/msg/ns3/ns3.tesh b/examples/msg/ns3/ns3.tesh index eb71bc162c..f9770e3ec5 100644 --- a/examples/msg/ns3/ns3.tesh +++ b/examples/msg/ns3/ns3.tesh @@ -13,16 +13,17 @@ $ ns3/ns3 ${srcdir:=.}/ns3/3links-p.xml ${srcdir:=.}/ns3/3links-d.xml --cfg=netw > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'NS3' > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s) > [C1:slave:(2) 0.104428] [msg_test/INFO] FLOW[1] : Receive 100000 bytes from S1 to C1 -> [C2:slave:(4) 0.555698] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from S2 to C2 -> [C3:slave:(6) 1.076972] [msg_test/INFO] FLOW[3] : Receive 2000000 bytes from S3 to C3 +> [C2:slave:(4) 1.041346] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from S2 to C2 +> [C3:slave:(6) 2.082380] [msg_test/INFO] FLOW[3] : Receive 2000000 bytes from S3 to C3 + $ ns3/ns3 ${srcdir:=.}/ns3/3links-p.xml ${srcdir:=.}/ns3/3links-d-timer.xml --cfg=network/model:NS3 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'NS3' > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s) > [C1:slave:(2) 0.104428] [msg_test/INFO] FLOW[1] : Receive 100000 bytes from S1 to C1 -> [C2:slave:(4) 0.555698] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from S2 to C2 -> [C3:slave:(6) 1.076972] [msg_test/INFO] FLOW[3] : Receive 2000000 bytes from S3 to C3 -> [C3:slave:(7) 3.076972] [msg_test/INFO] FLOW[4] : Receive 2000000 bytes from S3 to C3 +> [C2:slave:(4) 1.041346] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from S2 to C2 +> [C3:slave:(6) 2.082422] [msg_test/INFO] FLOW[3] : Receive 2000000 bytes from S3 to C3 +> [C3:slave:(7) 4.164594] [msg_test/INFO] FLOW[4] : Receive 2000000 bytes from S3 to C3 p One cluster diff --git a/src/surf/ns3/ns3_simulator.cc b/src/surf/ns3/ns3_simulator.cc index 9509298806..8b8a00cc40 100644 --- a/src/surf/ns3/ns3_simulator.cc +++ b/src/surf/ns3/ns3_simulator.cc @@ -140,7 +140,7 @@ static void send_callback(Ptr localSocket, uint32_t txSpace){ uint8_t *data = (uint8_t*)malloc(sizeof(uint8_t)*txSpace); - while (mysocket->sentBytes < mysocket->totalBytes + while (mysocket->bufferedBytes < mysocket->totalBytes && localSocket->GetTxAvailable () > 0) { uint32_t toWrite = min ((mysocket->remaining), txSpace); @@ -149,15 +149,15 @@ static void send_callback(Ptr localSocket, uint32_t txSpace){ if(amountSent < 0) return; - (mysocket->sentBytes) += amountSent; - (mysocket->remaining) -= amountSent; + (mysocket->bufferedBytes) += amountSent; + (mysocket->remaining) -= amountSent; XBT_DEBUG("send_cb of F[%p, %p, %d] (%d/%d) %d buffered", mysocket, mysocket->action, mysocket->totalBytes, mysocket->remaining, mysocket->totalBytes, amountSent); } free(data); - if ((mysocket->sentBytes) >= mysocket->totalBytes){ + if ((mysocket->bufferedBytes) >= mysocket->totalBytes){ localSocket->Close(); } }