X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bdb0a3e2930854b00da7e50bf8fb8690580231ad..1a39cc6fdc908c33507b5b0f8bae61f7286fd4ca:/examples/amok/bandwidth/bandwidth.c diff --git a/examples/amok/bandwidth/bandwidth.c b/examples/amok/bandwidth/bandwidth.c index c703fee2f3..5ef8a16484 100644 --- a/examples/amok/bandwidth/bandwidth.c +++ b/examples/amok/bandwidth/bandwidth.c @@ -1,8 +1,7 @@ -/* $Id$ */ - /* bandwidth - bandwidth test demo of GRAS features */ -/* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */ +/* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -12,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 @@ -92,9 +92,8 @@ int maestro(int argc, char *argv[]) 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)); + char *msg = bprintf("Not enough peers arrived. Expected 2 got %ld", + xbt_dynar_length(group)); amok_pm_group_shutdown("bandwidth"); xbt_die(msg); } @@ -111,19 +110,21 @@ int maestro(int argc, char *argv[]) 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); + 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); + ("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); + ("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");