Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Propagate the change the API of GRAS measurement sockets into the saturation code.
[simgrid.git] / src / amok / Bandwidth / saturate.c
index 78b4464..c504ab0 100644 (file)
@@ -71,10 +71,10 @@ void amok_bw_saturate_start(const char* from_name,unsigned int from_port,
                            const char* to_name,unsigned int to_port,
                            unsigned int msg_size, double duration) {
   gras_socket_t sock;
-  xbt_ex_t e;
   sat_request_t request = xbt_new(s_sat_request_t,1);
 
-  INFO2("from_name %s // to_name %s \n",from_name,to_name); 
+  VERB4("Start from_name %s:%d -> to_name %s:%d",
+       from_name, from_port, to_name, to_port);
   sock = gras_socket_client(from_name,from_port);
 
   request->peer.name = (char*)to_name;
@@ -83,14 +83,8 @@ void amok_bw_saturate_start(const char* from_name,unsigned int from_port,
   request->duration=duration;
   request->msg_size=msg_size;
 
- TRY{
   gras_msg_rpccall(sock,60,gras_msgtype_by_name("amok_bw_sat start"),&request, NULL);
 
-  }CATCH(e){
-    if (e.value==1)
-      THROW1(0,1,"%s",to_name);
-    THROW1(0,0,"%s",from_name);
-  }
   free(request);
   gras_socket_close(sock);
 }
@@ -100,23 +94,16 @@ static int amok_bw_cb_sat_start(gras_msg_cb_ctx_t ctx, void *payload){
   sat_request_t request = *(sat_request_t*)payload;
   gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
  
-  xbt_ex_t e;
-
   VERB4("Asked by %s:%d to start a saturation to %s:%d",
        gras_socket_peer_name(expeditor),gras_socket_peer_port(expeditor),
        request->peer.name,request->peer.port);
        
   gras_msg_rpcreturn(60,ctx, NULL);
 
-TRY{
   amok_bw_saturate_begin(request->peer.name,request->peer.port,
 
                         request->msg_size, request->duration,
                         NULL,NULL);
-
-  }CATCH(e){
-     THROW1(0,1," can not connect %s ",((request)->peer.name));
-  }
  
   free(request->peer.name);
 
@@ -142,7 +129,7 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
  
   xbt_ex_t e;
 
-  gras_socket_t peer_cmd; //= gras_socket_client(to_name, to_port);
+  gras_socket_t peer_cmd = gras_socket_client(to_name, to_port);
   gras_msg_cb_ctx_t ctx;
 
   gras_socket_t meas;
@@ -193,14 +180,14 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
   free(request);
 
   gras_socket_close(peer_cmd);
-  INFO2("Saturation(%s->%s) started",gras_os_myname(),to_name);
+  INFO4("Saturation(%s:%d->%s:%d) started",gras_os_myname(),gras_os_myport(),to_name,to_port);
 
   /* Start experiment */
   start=gras_os_time();
 
   do {
     /* do send it */
-    gras_socket_meas_send(meas,120,msg_size,msg_size);
+    gras_socket_meas_send(meas, 120, msg_size, 1);
     packet_sent++;
 
     /* Check whether someone asked us to stop saturation */
@@ -236,8 +223,8 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
     bw_res_t answer = xbt_new(s_bw_res_t,1);
     s_gras_msg_cb_ctx_t ctx;
 
-    INFO3("Saturation from %s to %s stopped by %s",
-         gras_os_myname(),to_name, gras_socket_peer_name(msg_got.expe));
+    INFO6("Saturation from %s:%d to %s:%d stopped by %s:%d",
+         gras_os_myname(),gras_os_myport(),to_name,to_port, gras_socket_peer_name(msg_got.expe),gras_socket_peer_port(msg_got.expe));
     answer->timestamp=gras_os_time();
     answer->sec=elapsed;
     answer->bw=bw;
@@ -249,8 +236,8 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
     gras_msg_rpcreturn(60,&ctx,&answer);
     free(answer);
   } else {
-    INFO4("Saturation from %s to %s elapsed after %f sec (achieving %f kb/s)",
-         gras_os_myname(),to_name,elapsed,bw/1024.0);
+    INFO6("Saturation from %s:%d to %s:%d elapsed after %f sec (achieving %f kb/s)",
+         gras_os_myname(),gras_os_myport(),to_name,to_port,elapsed,bw/1024.0);
   }
   
   gras_socket_close(meas);
@@ -298,15 +285,15 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload){
 
   while (saturate_further) {
     TRY {
-      gras_socket_meas_recv(meas,5,request->msg_size,request->msg_size);
+      gras_socket_meas_recv(meas, 5, request->msg_size, 1);
     } CATCH(e) {
       saturate_further = 0;
       xbt_ex_free(e);
     }
   }
-  INFO3("Saturation comming from %s:%d stopped on %s",
+  INFO4("Saturation comming from %s:%d stopped on %s:%d",
        gras_socket_peer_name(from),gras_socket_peer_port(from),
-       gras_os_myname());
+       gras_os_myname(),gras_os_myport());
 
   gras_socket_close(meas);
   if (gras_if_RL()) /* On SG, accepted=master */