From: amad206 Date: Mon, 3 Apr 2006 10:11:01 +0000 (+0000) Subject: the code of Matrix bandwidth function X-Git-Tag: v3.3~3305 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f3ccc5f8981f5b1e258cab911a09679860b8cc7d?ds=sidebyside the code of Matrix bandwidth function git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2053 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/amok/Bandwidth/bandwidth.c b/src/amok/Bandwidth/bandwidth.c index 6a13c6956e..c9601a080a 100644 --- a/src/amok/Bandwidth/bandwidth.c +++ b/src/amok/Bandwidth/bandwidth.c @@ -2,7 +2,9 @@ /* amok_bandwidth - Bandwidth tests facilities */ -/* Copyright (c) 2003-5 Martin Quinson. All rights reserved. */ +/* Copyright (c) 2003-6 Martin Quinson. */ +/* Copyright (c) 2006 Ahmed Harbaoui. */ +/* 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. */ @@ -368,3 +370,37 @@ int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, CRITICAL0("amok_bw_cb_sat_begin: not implemented"); return 1; } + +double * amok_bw_matrix(xbt_dynar_t hosts, + int buf_size_bw, int exp_size_bw, int msg_size_bw) { + double sec; + /* construct of matrixs for bandwith and Latency */ + + + double *matrix_bw; /* matrix bandwidth */ + int i,j,len=xbt_dynar_length(hosts); + + matrix_bw = (double *) malloc(sizeof(double)* len*len); + + xbt_host_t h1,h2; + + h1 = xbt_new(s_xbt_host_t,1); + h2 = xbt_new(s_xbt_host_t,1); + i=0; + xbt_dynar_foreach (hosts,i,h1) { + j=0; + xbt_dynar_foreach (hosts,j,h2) { + if(i!=j) { + /* Mesurements of Bandwidth */ + amok_bw_request(h1->name,h1->port,h2->name,h2->port, + buf_size_bw,exp_size_bw,msg_size_bw,&sec,&matrix_bw[i*len + j]); + } else { + matrix_bw[i*len +j] = 0.0; + } + + } + } + free(h1); + free(h2); + return matrix_bw; +}