Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce default verbosity, shorten a message
[simgrid.git] / src / amok / Bandwidth / bandwidth.c
index 8e51556..01d1127 100644 (file)
@@ -13,7 +13,7 @@
 #include "amok/Bandwidth/bandwidth_private.h"
 #include "gras/messages.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(bw,amok,"Bandwidth testing");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_bw,amok,"Bandwidth testing");
 
 
 /******************************
@@ -98,7 +98,7 @@ void amok_bw_bw_leave() {
  * \brief bandwidth measurement between localhost and \e peer
  * 
  * \arg peer: A (regular) socket at which the the host with which we should conduct the experiment can be contacted
- * \arg buf_size: Size of the socket buffer
+ * \arg buf_size: Size of the socket buffer. If 0, a sain default is used (32k, but may change)
  * \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 sec: where the result (in seconds) should be stored.
@@ -129,7 +129,7 @@ void amok_bw_test(gras_socket_t peer,
       if (port == 10000 -1) {
        RETHROW0("Error caught while opening a measurement socket: %s");
       } else {
-       xbt_ex_free(&e);        
+       xbt_ex_free(e); 
       }
     }
   }
@@ -140,7 +140,7 @@ void amok_bw_test(gras_socket_t peer,
   request->msg_size=msg_size;
   request->host.name = NULL;
   request->host.port = gras_socket_my_port(measMasterIn);
-  VERB5("Handshaking with %s:%d to connect it back on my %d (expsize=%ld byte= %ld b)", 
+  DEBUG5("Handshaking with %s:%d to connect it back on my %d (expsize=%ld byte= %ld b)", 
        gras_socket_peer_name(peer),gras_socket_peer_port(peer), request->host.port,
        buf_size,request->buf_size);
 
@@ -202,7 +202,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
   xbt_ex_t e;
   int port;
   
-  VERB5("Handshaked to connect to %s:%d (sizes: buf=%lu exp=%lu msg=%lu)",
+  DEBUG5("Handshaked to connect to %s:%d (sizes: buf=%lu exp=%lu msg=%lu)",
        gras_socket_peer_name(expeditor),request->host.port,
        request->buf_size,request->exp_size,request->msg_size);     
 
@@ -215,7 +215,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
     } CATCH(e) {
       measMasterIn = NULL;
       if (port < 10000)
-       xbt_ex_free(&e);
+       xbt_ex_free(e);
       else
        /* FIXME: tell error to remote */
        RETHROW0("Error encountered while opening a measurement server socket: %s");
@@ -281,7 +281,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
  * \arg to_port: port on which the second process is listening (for messages, do not 
  * give a measurement socket here. The needed measurement sockets will be created 
  * automatically and negociated between the peers)
- * \arg buf_size: Size of the socket buffer
+ * \arg buf_size: Size of the socket buffer. If 0, a sain default is used (32k, but may change)
  * \arg exp_size: Total size of data sent across the network
  * \arg msg_size: Size of each message sent. (\e expSize % \e msgSize) messages will be sent.
  * \arg sec: where the result (in seconds) should be stored.
@@ -320,9 +320,9 @@ void amok_bw_request(const char* from_name,unsigned int from_port,
   if (bw)
     *bw =result->bw;
 
-  VERB6("BW test between %s:%d and %s:%d took %f sec, achieving %f kb/s",
+  VERB6("BW test (%s:%d -> %s:%d) took %f sec (%f kb/s)",
        from_name,from_port, to_name,to_port,
-       *sec,((double)*bw)/1024.0);
+       result->sec,((double)result->bw)/1024.0);
 
   gras_socket_close(sock);
   free(result);
@@ -335,8 +335,12 @@ int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx,
   /* specification of the test to run, and our answer */
   bw_request_t request = *(bw_request_t*)payload;
   bw_res_t result = xbt_new0(s_bw_res_t,1);
-  gras_socket_t peer;
+  gras_socket_t peer,asker;
 
+  asker=gras_msg_cb_ctx_from(ctx);
+  VERB4("Asked by %s:%d to conduct a bw XP with %s:%d",        
+       gras_socket_peer_name(asker),gras_socket_peer_port(asker),
+       request->host.name,request->host.port);
   peer = gras_socket_client(request->host.name,request->host.port);
   amok_bw_test(peer,
               request->buf_size,request->exp_size,request->msg_size,
@@ -345,7 +349,7 @@ int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx,
   gras_msg_rpcreturn(240,ctx,&result);
 
   gras_os_sleep(1);
-  gras_socket_close(peer);
+  gras_socket_close(peer); /* FIXME: it should be blocking in RL until everything is sent */
   free(request->host.name);
   free(request);
   free(result);