From: Maximiliano Geier Date: Fri, 1 Feb 2013 09:42:02 +0000 (+0100) Subject: chainsend: remove active wait at peer termination X-Git-Tag: v3_9_90~540 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f914c94fcd14228f2b19d4bc29da518cad6755c0?ds=sidebyside chainsend: remove active wait at peer termination --- diff --git a/examples/msg/chainsend/chainsend.tesh b/examples/msg/chainsend/chainsend.tesh index 5454299d50..665323578b 100644 --- a/examples/msg/chainsend/chainsend.tesh +++ b/examples/msg/chainsend/chainsend.tesh @@ -5,12 +5,12 @@ p Testing the chainsend MSG implementation ! timeout 60 ! output sort $ $SG_TEST_EXENV ${bindir:=.}/chainsend ${srcdir:=.}/platform_chainsend.xml ${srcdir:=.}/deployment_tesh.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.125671] (2:peer@host1) ### 0.125671 16777216 bytes (Avg 127.316430 MB/s); copy finished (simulated). +> [ 0.157894] (3:peer@host2) ### 0.157894 16777216 bytes (Avg 101.333796 MB/s); copy finished (simulated). +> [ 0.158420] (4:peer@host3) ### 0.158420 16777216 bytes (Avg 100.997152 MB/s); copy finished (simulated). +> [ 0.159139] (5:peer@host4) ### 0.159139 16777216 bytes (Avg 100.541154 MB/s); copy finished (simulated). +> [ 0.191593] (6:peer@host5) ### 0.191593 16777216 bytes (Avg 83.510414 MB/s); copy finished (simulated). +> [ 0.191989] (7:peer@host6) ### 0.191989 16777216 bytes (Avg 83.338080 MB/s); copy finished (simulated). +> [ 0.229841] (0:@) Total simulation time: 2.298413e-01 +> [ 0.229841] (8:peer@host7) ### 0.229841 16777216 bytes (Avg 69.613244 MB/s); copy finished (simulated). > [ 0.229841] (9:peer@host8) ### 0.229841 16777216 bytes (Avg 69.613244 MB/s); copy finished (simulated). -> [ 2.055157] (2:peer@host1) ### 2.055157 16777216 bytes (Avg 7.785292 MB/s); copy finished (simulated). -> [ 2.125671] (3:peer@host2) ### 2.125671 16777216 bytes (Avg 7.527034 MB/s); copy finished (simulated). -> [ 2.157894] (4:peer@host3) ### 2.157894 16777216 bytes (Avg 7.414636 MB/s); copy finished (simulated). -> [ 2.158420] (5:peer@host4) ### 2.158420 16777216 bytes (Avg 7.412829 MB/s); copy finished (simulated). -> [ 2.159139] (6:peer@host5) ### 2.159139 16777216 bytes (Avg 7.410362 MB/s); copy finished (simulated). -> [ 2.191593] (7:peer@host6) ### 2.191593 16777216 bytes (Avg 7.300626 MB/s); copy finished (simulated). -> [ 2.191989] (0:@) Total simulation time: 2.191989e+00 -> [ 2.191989] (8:peer@host7) ### 2.191989 16777216 bytes (Avg 7.299307 MB/s); copy finished (simulated). diff --git a/examples/msg/chainsend/peer.c b/examples/msg/chainsend/peer.c index 1827df869c..4d0f9a07df 100644 --- a/examples/msg/chainsend/peer.c +++ b/examples/msg/chainsend/peer.c @@ -104,17 +104,18 @@ void peer_init(peer_t p, int argc, char *argv[]) void peer_shutdown(peer_t p) { - float start_time = MSG_get_clock(); - float end_time = start_time + PEER_SHUTDOWN_DEADLINE; + unsigned int size = xbt_dynar_length(p->pending_sends); + unsigned int idx; + msg_comm_t *comms = xbt_new(msg_comm_t, size); - XBT_DEBUG("Waiting for sends to finish before shutdown..."); - /* MSG_comm_waitall(p->pending_sends, PEER_SHUTDOWN_DEADLINE); FIXME: this doesn't work */ - while (xbt_dynar_length(p->pending_sends) && MSG_get_clock() < end_time) { - process_pending_connections(p->pending_sends); - MSG_process_sleep(1); + for (idx = 0; idx < size; idx++) { + comms[idx] = xbt_dynar_get_as(p->pending_sends, idx, msg_comm_t); } - xbt_assert(xbt_dynar_length(p->pending_sends) == 0, "Shutdown failed, sends still pending after deadline"); + XBT_DEBUG("Waiting for sends to finish before shutdown..."); + MSG_comm_waitall(comms, size, PEER_SHUTDOWN_DEADLINE); + + xbt_free(comms); } void peer_delete(peer_t p)