Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
- Also adapt the message size when experiment is too short to avoid
[simgrid.git] / src / amok / Bandwidth / bandwidth.c
index 8e80a8d..07794c5 100644 (file)
@@ -153,7 +153,7 @@ void amok_bw_test(gras_socket_t peer,
        buf_size,request->buf_size);
 
   TRY {
-    gras_msg_rpccall(peer,60,
+    gras_msg_rpccall(peer,15,
                     gras_msgtype_by_name("BW handshake"),&request, &request_ack);
   } CATCH(e) {
     RETHROW0("Error encountered while sending the BW request: %s");
@@ -175,10 +175,13 @@ void amok_bw_test(gras_socket_t peer,
     if (*sec>0) {
       double meas_duration=*sec;
       request->exp_size = request->exp_size * (min_duration / meas_duration) * 1.1;
+      request->msg_size = request->msg_size * (min_duration / meas_duration) * 1.1;
 
-      DEBUG4("The experiment was too short (%f sec<%f sec). Redo it with exp_size=%ld (got %fkb/s)",
-            meas_duration,min_duration,request->exp_size,((double)exp_size) / *sec/1024);
+
+      DEBUG5("The experiment was too short (%f sec<%f sec). Redo it with exp_size=%ld msg_size=%ld (got %fkb/s)",
+            meas_duration,min_duration,request->exp_size,request->msg_size,((double)exp_size) / *sec/1024);
       gras_msg_rpccall(peer, 60, gras_msgtype_by_name("BW reask"),&request, NULL);      
+      DEBUG0("Peer is ready for another round of fun");
     }
 
     *sec=gras_os_time();
@@ -195,10 +198,11 @@ void amok_bw_test(gras_socket_t peer,
     DEBUG0("Experiment done");
 
     *sec = gras_os_time() - *sec;
-    *bw = ((double)exp_size) / *sec;
+    *bw = ((double)request->exp_size) / *sec;
   } while (*sec < min_duration);
 
-  DEBUG0("This measurement was long enough. Stop peer");
+  DEBUG2("This measurement was long enough (%f sec; found %f b/s). Stop peer",
+        *sec,*bw);
   gras_msg_send(peer, gras_msgtype_by_name("BW stop"), NULL);      
 
   free(request_ack);
@@ -297,6 +301,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
     void *payload;
     int msggot;
     TRY {
+      DEBUG0("Recv / Send the experiment");
       gras_socket_meas_recv(measIn, 120,request->exp_size,request->msg_size);
       gras_socket_meas_send(measOut,120,1,1);
       DEBUG0("ACK sent");
@@ -377,7 +382,7 @@ void amok_bw_request(const char* from_name,unsigned int from_port,
   sock = gras_socket_client(from_name,from_port);
   DEBUG4("Ask for a BW test between %s:%d and %s:%d",  from_name,from_port, to_name,to_port);
 
-  gras_msg_rpccall(sock,240,gras_msgtype_by_name("BW request"), &request, &result);
+  gras_msg_rpccall(sock,20*60,gras_msgtype_by_name("BW request"), &request, &result);
   
   if (sec)
     *sec=result->sec;