X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ca337b3f8a502edaa4cf997d8efb053811d2e0ce..c419b4a65b3ac53a2468d1090ef562bc088fcc24:/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 a7e6f36bd0..8be76d6d37 100644 --- a/teshsuite/surf/maxmin_bench/maxmin_bench.c +++ b/teshsuite/surf/maxmin_bench/maxmin_bench.c @@ -15,30 +15,28 @@ #include #include +#include double date; -unsigned long seedx= 0; +int64_t seedx= 0; -int myrand(); -inline int myrand() { +static int myrand(void) { seedx=seedx * 16807 % 2147483647; - return seedx%1000; + return (int32_t) seedx%1000; } -double float_random(double max); -double float_random(double max) +static double float_random(double max) { return ((max * myrand()) / (MYRANDMAX + 1.0)); } -int int_random(int max); -int int_random(int max) +static int int_random(int max) { - return (int) (((max * 1.0) * myrand()) / (MYRANDMAX + 1.0)); + return (int32_t) (((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); -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) +static 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) { lmm_system_t Sys = NULL; lmm_constraint_t *cnst = xbt_new0(lmm_constraint_t, nb_cnst); @@ -46,7 +44,7 @@ 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; - + Sys = lmm_system_new(1); for (i = 0; i < nb_cnst; i++) { @@ -57,16 +55,16 @@ void test(int nb_cnst, int nb_var, int nb_elem, int pw_base_limit, int pw_max_li else //Badly logarithmically random concurrency limit in [2^pw_base_limit+1,2^pw_base_limit+2^pw_max_limit] l=(1<l) - l=j; + l=j; printf("(%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"); + printf("\n"); } printf("\nTotal maximum concurrency is %i\n",l); lmm_print(Sys); } - + for (i = 0; i < nb_var; i++) lmm_variable_free(Sys, var[i]); lmm_system_free(Sys); free(cnst); free(var); free(used); - } int TestClasses [][4]= @@ -130,7 +127,7 @@ int main(int argc, char **argv) float acc_date=0,acc_date2=0; int testclass,mode,testcount; int i; - + if(argc<3) { printf("Syntax: [test|debug|perf]\n"); return -1; @@ -150,10 +147,9 @@ int main(int argc, char **argv) return -2; } - //How many times? testcount=atoi(argv[2]); - + //Show me everything (debug or performance)! mode=0; if(argc>=4 && strcmp(argv[3],"test")==0) @@ -163,14 +159,13 @@ int main(int argc, char **argv) if(argc>=4 && strcmp(argv[3],"perf")==0) mode=3; - if(mode==1) xbt_log_control_set("surf/maxmin.threshold:DEBUG surf/maxmin.fmt:\'[%r]: [%c/%p] %m%n\'\ surf.threshold:DEBUG surf.fmt:\'[%r]: [%c/%p] %m%n\' "); - + if(mode==2) xbt_log_control_set("surf/maxmin.threshold:DEBUG surf.threshold:DEBUG"); - + nb_cnst= TestClasses[testclass][0]; nb_var= TestClasses[testclass][1]; pw_base_limit= TestClasses[testclass][2]; @@ -183,7 +178,7 @@ int main(int argc, char **argv) //nb_elem=200 xbt_init(&argc, argv); - + for(i=0;i