X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6760cb07d6b57be16928d95339d71e57c4e24f36..9a8ce506851427358a58031d014dc51b353e4baa:/examples/amok/bandwidth/bandwidth.c diff --git a/examples/amok/bandwidth/bandwidth.c b/examples/amok/bandwidth/bandwidth.c index 1090b5f018..d2e232544f 100644 --- a/examples/amok/bandwidth/bandwidth.c +++ b/examples/amok/bandwidth/bandwidth.c @@ -11,7 +11,8 @@ #include "amok/bandwidth.h" #include "amok/peermanagement.h" -XBT_LOG_NEW_DEFAULT_CATEGORY(Bandwidth, "Messages specific to this example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(Bandwidth, + "Messages specific to this example"); /* ********************************************************************** * Sensor code @@ -32,13 +33,14 @@ int sensor(int argc, char *argv[]) amok_pm_init(); mysock = gras_socket_server_range(3000, 9999, 0, 0); - INFO1("Sensor starting (on port %d)", gras_os_myport()); + XBT_INFO("Sensor starting (on port %d)", gras_os_myport()); while (connection_try > 0 && master == NULL) { int connected = 0; TRY { master = gras_socket_client_from_string(argv[1]); connected = 1; - } CATCH(e) { + } + CATCH(e) { xbt_ex_free(e); } if (!connected) { @@ -80,22 +82,20 @@ int maestro(int argc, char *argv[]) amok_bw_init(); amok_pm_init(); - INFO0("Maestro starting"); + XBT_INFO("Maestro starting"); if (argc != 2) { - ERROR0("Usage: maestro port\n"); + XBT_ERROR("Usage: maestro port\n"); return 1; } mysock = gras_socket_server(atoi(argv[1])); group = amok_pm_group_new("bandwidth"); - INFO0("Wait for peers for 5 sec"); + XBT_INFO("Wait for peers for 5 sec"); gras_msg_handleall(5); /* friends, we're ready. Come and play */ if (xbt_dynar_length(group) < 2) { - char *msg; - asprintf(&msg, "Not enough peers arrived. Expected 2 got %ld", - xbt_dynar_length(group)); amok_pm_group_shutdown("bandwidth"); - xbt_die(msg); + xbt_die("Not enough peers arrived. Expected 2 got %ld", + xbt_dynar_length(group)); } h1 = *(xbt_peer_t *) xbt_dynar_get_ptr(group, 0); h2 = *(xbt_peer_t *) xbt_dynar_get_ptr(group, 1); @@ -106,23 +106,25 @@ int maestro(int argc, char *argv[]) h2 = h_temp; } - INFO2("Contact %s:%d", h1->name, h1->port); + XBT_INFO("Contact %s:%d", h1->name, h1->port); peer = gras_socket_client(h1->name, h1->port); - INFO0("Test the BW between me and one of the sensors"); - amok_bw_test(peer, buf_size, msg_size, msg_amount, min_duration, &sec, &bw); - INFO7 - ("Experience between me and %s:%d (initially %d msgs of %d bytes, maybe modified to fill the pipe at least %.1fs) took %f sec, achieving %f kb/s", - h1->name, h1->port, msg_amount, msg_size, min_duration, sec, - ((double) bw) / 1024.0); - - INFO4("Test the BW between %s:%d and %s:%d", h1->name, h1->port, h2->name, - h2->port); - amok_bw_request(h1->name, h1->port, h2->name, h2->port, buf_size, msg_size, - msg_amount, min_duration, &sec, &bw); - INFO6 - ("Experience between %s:%d and %s:%d took took %f sec, achieving %f kb/s", - h1->name, h1->port, h2->name, h2->port, sec, ((double) bw) / 1024.0); + XBT_INFO("Test the BW between me and one of the sensors"); + amok_bw_test(peer, buf_size, msg_size, msg_amount, min_duration, &sec, + &bw); + XBT_INFO + ("Experience between me and %s:%d (initially %d msgs of %d bytes, maybe modified to fill the pipe at least %.1fs) took %f sec, achieving %f kb/s", + h1->name, h1->port, msg_amount, msg_size, min_duration, sec, + ((double) bw) / 1024.0); + + XBT_INFO("Test the BW between %s:%d and %s:%d", h1->name, h1->port, + h2->name, h2->port); + amok_bw_request(h1->name, h1->port, h2->name, h2->port, buf_size, + msg_size, msg_amount, min_duration, &sec, &bw); + XBT_INFO + ("Experience between %s:%d and %s:%d took took %f sec, achieving %f kb/s", + h1->name, h1->port, h2->name, h2->port, sec, + ((double) bw) / 1024.0); /* Game is over, friends */ amok_pm_group_shutdown("bandwidth");