From: Lucas Schnorr Date: Thu, 8 Sep 2011 14:26:21 +0000 (+0200) Subject: [NS3] updated in the example to cover more execution scenarios X-Git-Tag: v3_6_2~107 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e771760a3246d2ba0ebf8e120a02f8c06a19205d [NS3] updated in the example to cover more execution scenarios details: - debug messages added - timer function is also executed to have a more detailed view of what is going on during the simulation of NS3 flows --- diff --git a/examples/msg/ns3/3links-d-timer.xml b/examples/msg/ns3/3links-d-timer.xml new file mode 100644 index 0000000000..9caa5cca2d --- /dev/null +++ b/examples/msg/ns3/3links-d-timer.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/msg/ns3/3links-d.xml b/examples/msg/ns3/3links-d.xml index b9a1cf4fff..40ddeba812 100644 --- a/examples/msg/ns3/3links-d.xml +++ b/examples/msg/ns3/3links-d.xml @@ -3,7 +3,7 @@ - + @@ -13,7 +13,7 @@ - + @@ -21,10 +21,10 @@ + - - - + + @@ -32,5 +32,10 @@ - + + diff --git a/examples/msg/ns3/3links-p.xml b/examples/msg/ns3/3links-p.xml index 2e1738dbe8..a7e6848251 100644 --- a/examples/msg/ns3/3links-p.xml +++ b/examples/msg/ns3/3links-p.xml @@ -19,9 +19,9 @@ - - - + + + diff --git a/examples/msg/ns3/ns3.c b/examples/msg/ns3/ns3.c index a40a8d5ff6..d0c7456e4b 100644 --- a/examples/msg/ns3/ns3.c +++ b/examples/msg/ns3/ns3.c @@ -19,7 +19,7 @@ int timer(int argc, char *argv[]); MSG_error_t test_all(const char *platform_file, const char *application_file); -int timer_start = 1; +int timer_start; //set as 1 in the master process typedef enum { PORT_22 = 0, @@ -49,9 +49,9 @@ int master(int argc, char *argv[]) //unique id to control statistics int id = -1; - if (argc != 4) { - XBT_INFO("Strange number of arguments expected 3 got %d", argc - 1); - } + xbt_assert(argc==4,"Strange number of arguments expected 3 got %d", argc - 1); + + XBT_DEBUG ("Master started"); /* data size */ int read; @@ -81,6 +81,7 @@ int master(int argc, char *argv[]) } count_finished++; + timer_start = 1 ; /* time measurement */ sprintf(id_alias, "%d", id); @@ -89,7 +90,7 @@ int master(int argc, char *argv[]) MSG_task_send(todo, id_alias); end_time = MSG_get_clock(); - + XBT_DEBUG ("Finished"); return 0; } /* end_of_master */ @@ -97,24 +98,26 @@ int master(int argc, char *argv[]) /** Timer function */ int timer(int argc, char *argv[]) { - int sleep_time; - int first_sleep; + double sleep_time; + double first_sleep; - if (argc != 3) { - XBT_INFO("Strange number of arguments expected 2 got %d", argc - 1); - } + xbt_assert(argc==3,"Strange number of arguments expected 2 got %d", argc - 1); + + sscanf(argv[1], "%lf", &first_sleep); + sscanf(argv[2], "%lf", &sleep_time); - sscanf(argv[1], "%d", &first_sleep); - sscanf(argv[2], "%d", &sleep_time); + XBT_DEBUG ("Timer started"); if(first_sleep){ MSG_process_sleep(first_sleep); } - while(timer_start){ + do { + XBT_DEBUG ("Get sleep"); MSG_process_sleep(sleep_time); - } + } while(timer_start); + XBT_DEBUG ("Finished"); return 0; } @@ -127,9 +130,9 @@ int slave(int argc, char *argv[]) int id = 0; char id_alias[10]; - if (argc != 2) { - XBT_INFO("Strange number of arguments expected 1 got %d", argc - 1); - } + xbt_assert(argc==2,"Strange number of arguments expected 1 got %d", argc - 1); + + XBT_DEBUG ("Slave started"); id = atoi(argv[1]); sprintf(id_alias, "%d", id); @@ -155,9 +158,10 @@ int slave(int argc, char *argv[]) MSG_task_get_data_size(task), masternames[id], slavenames[id]); - +// MSG_task_execute(task); MSG_task_destroy(task); + XBT_DEBUG ("Finished"); return 0; } /* end_of_slave */ diff --git a/examples/msg/ns3/ns3.tesh b/examples/msg/ns3/ns3.tesh index 02c6cb694c..4de9f8c62f 100644 --- a/examples/msg/ns3/ns3.tesh +++ b/examples/msg/ns3/ns3.tesh @@ -12,9 +12,17 @@ p 6hosts 3links $ ns3/ns3 ${srcdir:=.}/ns3/3links-p.xml ${srcdir:=.}/ns3/3links-d.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.392000] [msg_test/INFO] FLOW[1] : Receive 100 bytes from S1 to C1 -> [C2:slave:(4) 1.354000] [msg_test/INFO] FLOW[2] : Receive 1000 bytes from S2 to C2 -> [C3:slave:(6) 2.438000] [msg_test/INFO] FLOW[3] : Receive 2000 bytes from S3 to C3 +> [C1:slave:(2) 0.108460] [msg_test/INFO] FLOW[1] : Receive 100000 bytes from S1 to C1 +> [C2:slave:(4) 1.074465] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from S2 to C2 +> [C3:slave:(6) 2.116464] [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.108460] [msg_test/INFO] FLOW[1] : Receive 100000 bytes from S1 to C1 +> [C2:slave:(4) 1.074465] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from S2 to C2 +> [C3:slave:(6) 2.116506] [msg_test/INFO] FLOW[3] : Receive 2000000 bytes from S3 to C3 +> [C3:slave:(7) 4.232762] [msg_test/INFO] FLOW[4] : Receive 2000000 bytes from S3 to C3 p One cluster @@ -28,4 +36,4 @@ p Two clusters $ ns3/ns3 ${srcdir:=.}/ns3/Two_clusters.xml ${srcdir:=.}/ns3/Two_clusters-d.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) -> [c-16.me:slave:(2) 0.012453] [msg_test/INFO] FLOW[1] : Receive 100 bytes from c-3.me to c-16.me \ No newline at end of file +> [c-16.me:slave:(2) 0.012453] [msg_test/INFO] FLOW[1] : Receive 100 bytes from c-3.me to c-16.me