Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Arnaud ask me for more documentation in my code. Can you believe it ?? ;)
[simgrid.git] / src / amok / Bandwidth / bandwidth.c
index c7608b9..fe73944 100644 (file)
@@ -108,7 +108,7 @@ void amok_bw_bw_leave() {
  * \arg exp_size: Total size of data sent across the network
  * \arg msg_size: Size of each message sent. Ie, (\e expSize % \e msgSize) messages will be sent.
  * \arg min_duration: The minimum wanted duration. When the test message is too little, you tend to measure the latency. This argument allows you to force the test to take at least, say one second.
- * \arg sec: where the result (in seconds) should be stored.
+ * \arg sec: where the result (in seconds) should be stored. If the experiment was done several times because the first one was too short, this is the timing of the last run only.
  * \arg bw: observed Bandwidth (in byte/s) 
  *
  * Conduct a bandwidth test from the local process to the given peer.
@@ -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");
@@ -316,6 +321,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
       tooshort = 1;
       free(request);
       request = (bw_request_t)payload;
+      VERB0("Return the reasking RPC");
       gras_msg_rpcreturn(60,ctx_reask,NULL);
     }
     gras_msg_cb_ctx_free(ctx_reask);
@@ -374,7 +380,9 @@ void amok_bw_request(const char* from_name,unsigned int from_port,
   request->host.port = to_port;
 
   sock = gras_socket_client(from_name,from_port);
-  gras_msg_rpccall(sock,240,gras_msgtype_by_name("BW request"),&request, &result);
+  DEBUG4("Ask for a BW test between %s:%d and %s:%d",  from_name,from_port, to_name,to_port);
+
+  gras_msg_rpccall(sock,20*60,gras_msgtype_by_name("BW request"), &request, &result);
   
   if (sec)
     *sec=result->sec;
@@ -419,11 +427,12 @@ int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx,
   return 1;
 }
 
+/** \brief builds a matrix of results of bandwidth measurement */
 double * amok_bw_matrix(xbt_dynar_t hosts,
                        int buf_size_bw, int exp_size_bw, int msg_size_bw,
                        double min_duration) { 
   double sec;
-  /* construct of matrixs for bandwith and Latency */
+  /* construction of matrices for bandwith and latency */
 
 
   int i,j,len=xbt_dynar_length(hosts);