- fprintf(stderr,"Did all BW tests in %ld sec (%.2f simulated sec)\n",
- time(NULL)-begin,gras_os_time()-beginSim);
-
- for (a=0; a<MAXHOSTS; a++) {
- for (b=0; b<MAXHOSTS; b++) {
- if (a==b) continue;
-
- if ((errcode=grasbw_saturate_start(hosts[a],4000,hosts[b],4000,satSize,360000000))) {
- fprintf(stderr,"MAESTRO: Error %s encountered while starting saturation\n",
- xbt_error_name(errcode));
- return -1;
+ INFO2("Saturation took %.2fsec, achieving %fb/s",duration,bw);
+
+ /* Game is over, friends */
+ amok_pm_group_shutdown ("saturate");
+}
+/********************************************************************************************/
+static void full_fledged_saturation(int argc, char*argv[]) {
+ xbt_ex_t e;
+ double time1=5.0,bw1=5.0; // 0.5 for test
+ /* timers */
+ double begin_simulated;
+ int begin;
+
+ /* where are the sensors */
+ xbt_dynar_t peers;
+ int nb_peers;
+
+ /* results */
+ double *bw;
+ double *bw_sat;
+
+ /* iterators */
+ int i,j,k,l;
+ xbt_peer_t h1,h2,h3,h4;
+
+ /* Init the group */
+ peers=amok_pm_group_new("saturate");
+ /* wait 4 dudes */
+ gras_msg_handle(60);
+ gras_msg_handle(60);
+ gras_msg_handle(60);
+ gras_msg_handle(60);
+ nb_peers = xbt_dynar_length(peers);
+
+ INFO0("Let's go for the bw_matrix");
+
+ /* Do the test without saturation */
+ begin=time(NULL);
+ begin_simulated=gras_os_time();
+
+ bw=amok_bw_matrix(peers,buf_size,msg_size,msg_amount,min_duration);
+
+ INFO2("Did all BW tests in %ld sec (%.2f simulated(?) sec)",
+ time(NULL)-begin,gras_os_time()-begin_simulated);
+
+ /* Do the test with saturation */
+ bw_sat=xbt_new(double,nb_peers*nb_peers);
+ xbt_dynar_foreach(peers,i,h1) {
+ xbt_dynar_foreach(peers,j,h2) {
+ if (i==j) continue;
+
+ TRY {
+ amok_bw_saturate_start(h1->name,h1->port,
+ h2->name,h2->port,
+ 0, /* Be nice, compute msg_size yourself */
+ 0 /* no timeout */);
+ } CATCH(e) {
+ RETHROW0("Cannot ask peers to saturate the link: %s");