X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b6fee195e15a7088e51c2c1f8526c34425858158..ba479548b9ab30bbfa69c8215cca6f03512c2f5d:/src/amok/Bandwidth/saturate.c diff --git a/src/amok/Bandwidth/saturate.c b/src/amok/Bandwidth/saturate.c index 033227d771..efa150caa7 100644 --- a/src/amok/Bandwidth/saturate.c +++ b/src/amok/Bandwidth/saturate.c @@ -10,8 +10,7 @@ #include "amok/Bandwidth/bandwidth_private.h" #include "gras/Msg/msg_private.h" /* FIXME: This mucks with contextes to answer RPC directly */ -XBT_LOG_EXTERNAL_CATEGORY(amok_bw); -XBT_LOG_DEFAULT_CATEGORY(amok_bw); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_bw_sat,amok_bw,"Everything concerning the SATuration part of the amok_bw module"); static int amok_bw_cb_sat_start(gras_msg_cb_ctx_t ctx, void *payload); static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload); @@ -114,7 +113,10 @@ static int amok_bw_cb_sat_start(gras_msg_cb_ctx_t ctx, void *payload){ * is to have a remote host calling amok_bw_saturate_stop to this process. * * If duration=0, the experiment will never timeout (you then have to manually - * stop it) + * stop it). + * + * If msg_size=0, the size will be automatically computed to make sure that + * each of the messages occupy the connexion one second */ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port, unsigned int msg_size, double duration, @@ -146,6 +148,18 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port, request->host.name = NULL; request->host.port = 0; + /* Size autodetection on need */ + if (!msg_size) { + double bw; + double sec; + amok_bw_test(peer_cmd, + 0,512*1024, 512*1024, /* 512k as first guess */ + 1, /* at least one sec */ + &sec, &bw); + request->msg_size = (int)bw; + } + + /* Launch the saturation */ ctx = gras_msg_rpc_async_call(peer_cmd, 60, gras_msgtype_by_name("amok_bw_sat begin"), &request); @@ -157,7 +171,7 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port, free(request); gras_socket_close(peer_cmd); - INFO2("Saturation from %s to %s started",gras_os_myname(),to_name); + INFO2("Saturation(%s->%s) started",gras_os_myname(),to_name); /* Start experiment */ start=gras_os_time(); @@ -184,7 +198,7 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port, /* Check whether the experiment has to be terminated by now */ elapsed=gras_os_time()-start; - VERB2("elapsed %f duration %f",elapsed, duration); + DEBUG2("elapsed %f duration %f",elapsed, duration); } while (saturate_further && (duration==0 || elapsed < duration)); @@ -262,7 +276,7 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload){ while (saturate_further) { TRY { - gras_socket_meas_recv(meas,120,request->msg_size,request->msg_size); + gras_socket_meas_recv(meas,5,request->msg_size,request->msg_size); } CATCH(e) { saturate_further = 0; xbt_ex_free(e); @@ -289,12 +303,16 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload){ */ void amok_bw_saturate_stop(const char* from_name,unsigned int from_port, /*out*/ double *time, double *bw) { - + xbt_ex_t e; + gras_socket_t sock = gras_socket_client(from_name,from_port); bw_res_t answer; - VERB2("Ask %s:%d to stop the saturation", - from_name,from_port); - gras_msg_rpccall(sock,60,gras_msgtype_by_name("amok_bw_sat stop"),NULL,&answer); + VERB2("Ask %s:%d to stop the saturation",from_name,from_port); + TRY { + gras_msg_rpccall(sock,60,gras_msgtype_by_name("amok_bw_sat stop"),NULL,&answer); + } CATCH(e) { + RETHROW2("Cannot ask %s:%d to stop saturation: %s",from_name, from_port); + } gras_socket_close(sock); if (time) *time=answer->sec; if (bw) *bw =answer->bw;