X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d451c4179815683bdf2303edea68709a65155988..abc179ad0abd38c45f0f7c4d63141d4548b77da8:/teshsuite/surf/maxmin_bench/maxmin_bench.c diff --git a/teshsuite/surf/maxmin_bench/maxmin_bench.c b/teshsuite/surf/maxmin_bench/maxmin_bench.c index 6b1ca7f12f..79d660e705 100644 --- a/teshsuite/surf/maxmin_bench/maxmin_bench.c +++ b/teshsuite/surf/maxmin_bench/maxmin_bench.c @@ -11,21 +11,30 @@ #include "xbt/xbt_os_time.h" #include "xbt/sysdep.h" /* time manipulation for benchmarking */ +#define MYRANDMAX 1000 + #include #include double date; +unsigned long seedx= 0; + +int myrand(); +inline int myrand() { + seedx=seedx * 16807 % 2147483647; + return seedx%1000; +} double float_random(double max); double float_random(double max) { - return ((max * rand()) / (RAND_MAX + 1.0)); + return ((max * myrand()) / (MYRANDMAX + 1.0)); } int int_random(int max); int int_random(int max) { - return (int) (((max * 1.0) * rand()) / (RAND_MAX + 1.0)); + return (int) (((max * 1.0) * myrand()) / (MYRANDMAX + 1.0)); } void test(int nb_cnst, int nb_var, int nb_elem, int pw_base_limit, int pw_max_limit, float rate_no_limit, int max_share, int mode); @@ -37,6 +46,8 @@ void test(int nb_cnst, int nb_var, int nb_elem, int pw_base_limit, int pw_max_li int *used = xbt_new0(int, nb_cnst); int i, j, k,l; int concurrency_share; + + char buf[1000]; Sys = lmm_system_new(1); @@ -72,7 +83,7 @@ void test(int nb_cnst, int nb_var, int nb_elem, int pw_base_limit, int pw_max_li } } - printf("Starting to solve\n"); + printf("Starting to solve(%i)\n",myrand()%1000); date = xbt_os_time() * 1000000; lmm_solve(Sys); date = xbt_os_time() * 1000000 - date; @@ -80,17 +91,20 @@ void test(int nb_cnst, int nb_var, int nb_elem, int pw_base_limit, int pw_max_li if(mode==1){ printf("Max concurrency:\n"); l=0; + buf[0]=0; for (i = 0; i < nb_cnst; i++) { j=lmm_constraint_concurrency_maximum_get(cnst[i]); k=lmm_constraint_concurrency_limit_get(cnst[i]); xbt_assert(k<0 || j<=k); if(j>l) l=j; - printf("(%i):%i/%i ",i,j,k); + sprintf(buf+strlen(buf),"(%i):%i/%i ",i,j,k); lmm_constraint_concurrency_maximum_reset(cnst[i]); xbt_assert(!lmm_constraint_concurrency_maximum_get(cnst[i])); - if(i%10==9) - printf("\n"); + if(i%10==9) { + printf("%s\n",buf); + buf[0]=0; + } } printf("\nTotal maximum concurrency is %i\n",l); @@ -141,6 +155,7 @@ int main(int argc, char **argv) return -2; } + //How many times? testcount=atoi(argv[2]); @@ -175,6 +190,8 @@ int main(int argc, char **argv) xbt_init(&argc, argv); for(i=0;i