Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
We can use the cluster tag without backbone link if bb_bw and bb_lat attributes are...
[simgrid.git] / examples / amok / saturate / saturate.c
index 1b77417..b89dccc 100644 (file)
@@ -36,7 +36,7 @@ int sensor(int argc, char *argv[])
   amok_pm_init();
 
   mysock = gras_socket_server_range(3000, 9999, 0, 0);
-  INFO1("Sensor starting (on port %d)", gras_os_myport());
+  XBT_INFO("Sensor starting (on port %d)", gras_os_myport());
   gras_os_sleep(2);             /* let the master get ready */
   master = gras_socket_client_from_string(argv[1]);
 
@@ -73,7 +73,7 @@ static double XP(const char *bw1, const char *bw2,
   /* Test BW without saturation */
   amok_bw_request(bw1, 4000, bw2, 4000,
                   buf_size, msg_size, msg_amount, min_duration, &sec, &bw);
-  INFO4("BW(%s,%s) => %f sec, achieving %f Mb/s",
+  XBT_INFO("BW(%s,%s) => %f sec, achieving %f Mb/s",
         bw1, bw2, sec, (bw / 1024.0 / 1024.0));
 
 
@@ -84,16 +84,16 @@ static double XP(const char *bw1, const char *bw2,
   amok_bw_request(bw1, 4000, bw2, 4000,
                   buf_size, msg_size, msg_amount, min_duration, &sec_sat,
                   &bw_sat);
-  INFO6("BW(%s,%s//%s,%s) => %f sec, achieving %f Mb/s", bw1, bw2, sat1,
+  XBT_INFO("BW(%s,%s//%s,%s) => %f sec, achieving %f Mb/s", bw1, bw2, sat1,
         sat2, sec, bw / 1024.0 / 1024.0);
 
   amok_bw_saturate_stop(sat1, 4000, NULL, NULL);
 
   if (bw_sat / bw < 0.7) {
-    INFO0("THERE IS SOME INTERFERENCE !!!");
+    XBT_INFO("THERE IS SOME INTERFERENCE !!!");
   }
   if (bw / bw_sat < 0.7) {
-    INFO0("THERE IS SOME INTERFERENCE (and I'm an idiot) !!!");
+    XBT_INFO("THERE IS SOME INTERFERENCE (and I'm an idiot) !!!");
   }
   return bw_sat / bw;
 }
@@ -145,24 +145,24 @@ static void simple_saturation(int argc, char *argv[])
   xbt_dynar_get_cpy(peers, 1, &h2);
 
   /* Start saturation */
-  INFO4("Start saturation between %s:%d and %s:%d",
+  XBT_INFO("Start saturation between %s:%d and %s:%d",
         h1->name, h1->port, h2->name, h2->port);
 
   amok_bw_saturate_start(h1->name, h1->port, h2->name, h2->port, 0,     /* Be a nice boy, compute msg_size yourself */
                          30 /* 5 sec timeout */ );
 
   /* Stop it after a while */
-  INFO0("Have a rest");
+  XBT_INFO("Have a rest");
   gras_os_sleep(1);
   TRY {
-    INFO0("Stop the saturation");
+    XBT_INFO("Stop the saturation");
     amok_bw_saturate_stop(h1->name, h1->port, &duration, &bw);
   }
   CATCH(e) {
-    INFO0("Ooops, stoping the saturation raised an exception");
+    XBT_INFO("Ooops, stoping the saturation raised an exception");
     xbt_ex_free(e);
   }
-  INFO2("Saturation took %.2fsec, achieving %fb/s", duration, bw);
+  XBT_INFO("Saturation took %.2fsec, achieving %fb/s", duration, bw);
 
   /* Game is over, friends */
   amok_pm_group_shutdown("saturate");
@@ -171,7 +171,6 @@ static void simple_saturation(int argc, char *argv[])
 /********************************************************************************************/
 static void full_fledged_saturation(int argc, char *argv[])
 {
-  xbt_ex_t e;
   double time1 = 5.0, bw1 = 5.0;        // 0.5 for test
   /* timers */
   double begin_simulated;
@@ -198,7 +197,7 @@ static void full_fledged_saturation(int argc, char *argv[])
   gras_msg_handle(60);
   nb_peers = xbt_dynar_length(peers);
 
-  INFO0("Let's go for the bw_matrix");
+  XBT_INFO("Let's go for the bw_matrix");
 
   /* Do the test without saturation */
   begin = time(NULL);
@@ -206,7 +205,7 @@ static void full_fledged_saturation(int argc, char *argv[])
 
   bw = amok_bw_matrix(peers, buf_size, msg_size, msg_amount, min_duration);
 
-  INFO2("Did all BW tests in %ld sec (%.2f simulated(?) sec)",
+  XBT_INFO("Did all BW tests in %ld sec (%.2f simulated(?) sec)",
         (long int) (time(NULL) - begin), gras_os_time() - begin_simulated);
 
   /* Do the test with saturation */
@@ -220,8 +219,8 @@ static void full_fledged_saturation(int argc, char *argv[])
         amok_bw_saturate_start(h1->name, h1->port, h2->name, h2->port, 0,       /* Be nice, compute msg_size yourself */
                                0 /* no timeout */ );
       }
-      CATCH(e) {
-        RETHROW0("Cannot ask peers to saturate the link: %s");
+      CATCH_ANONYMOUS {
+        RETHROWF("Cannot ask peers to saturate the link: %s");
       }
       gras_os_sleep(5);
 
@@ -236,14 +235,14 @@ static void full_fledged_saturation(int argc, char *argv[])
           if (i == l || j == l || k == l)
             continue;
 
-          VERB4("TEST %s %s // %s %s",
+          XBT_VERB("TEST %s %s // %s %s",
                 h1->name, h2->name, h3->name, h4->name);
           amok_bw_request(h3->name, h3->port, h4->name, h4->port,
                           buf_size, msg_size, msg_amount, min_duration,
                           NULL, &(bw_sat[k * nb_peers + l]));
 
           ratio = bw_sat[k * nb_peers + l] / bw[k * nb_peers + l];
-          INFO8("SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s",
+          XBT_INFO("SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s",
                 h1->name, h2->name, h3->name, h4->name,
                 ratio,
                 bw[k * nb_peers + l], bw_sat[k * nb_peers + l],
@@ -252,11 +251,11 @@ static void full_fledged_saturation(int argc, char *argv[])
       }
       amok_bw_saturate_stop(h1->name, h1->port, &time1, &bw1);
 
-      INFO2
+      XBT_INFO
           ("Did an iteration on saturation pair in %ld sec (%.2f simulated sec)",
            (long int) (time(NULL) - begin),
            gras_os_time() - begin_simulated);
-      INFO2
+      XBT_INFO
           ("the duration of the experiment >>>>> %.3f sec (%.3f bandwidth)",
            time1, bw1);
     }