Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More logging and other cosmetics
[simgrid.git] / src / amok / Bandwidth / bandwidth.c
index 519e536..8e80a8d 100644 (file)
@@ -174,10 +174,10 @@ void amok_bw_test(gras_socket_t peer,
   do {
     if (*sec>0) {
       double meas_duration=*sec;
-      request->msg_size = request->msg_size * (min_duration / meas_duration);
+      request->exp_size = request->exp_size * (min_duration / meas_duration) * 1.1;
 
-      DEBUG3("The experiment was too short (%f sec<%f sec). Redo it with msg_size=%ld",
-            meas_duration,min_duration,request->msg_size);
+      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);
       gras_msg_rpccall(peer, 60, gras_msgtype_by_name("BW reask"),&request, NULL);      
     }
 
@@ -316,6 +316,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);
@@ -356,6 +357,7 @@ void amok_bw_request(const char* from_name,unsigned int from_port,
                     unsigned long int buf_size,
                     unsigned long int exp_size,
                     unsigned long int msg_size,
+                    double min_duration,
             /*OUT*/ double *sec, double*bw) {
   
   gras_socket_t sock;
@@ -367,12 +369,15 @@ void amok_bw_request(const char* from_name,unsigned int from_port,
   request->buf_size=buf_size;
   request->exp_size=exp_size;
   request->msg_size=msg_size;
+  request->min_duration = min_duration;
 
   request->host.name = (char*)to_name;
   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,240,gras_msgtype_by_name("BW request"), &request, &result);
   
   if (sec)
     *sec=result->sec;
@@ -403,7 +408,7 @@ int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx,
   peer = gras_socket_client(request->host.name,request->host.port);
   amok_bw_test(peer,
               request->buf_size,request->exp_size,request->msg_size,
-              0,
+              request->min_duration,
               &(result->sec),&(result->bw));
 
   gras_msg_rpcreturn(240,ctx,&result);
@@ -417,10 +422,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) { 
+                       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);
@@ -433,7 +440,8 @@ double * amok_bw_matrix(xbt_dynar_t hosts,
       if (i!=j) {
         /* Mesurements of Bandwidth */
         amok_bw_request(h1->name,h1->port,h2->name,h2->port,
-                        buf_size_bw,exp_size_bw,msg_size_bw,&sec,&matrix_res[i*len + j]);
+                        buf_size_bw,exp_size_bw,msg_size_bw,min_duration,
+                       &sec,&matrix_res[i*len + j]);
       } 
     }
   }