X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/014e592abcb107ab479f3e1900b142be43bd47d3..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 612bd015bf..8be76d6d37 100644 --- a/teshsuite/surf/maxmin_bench/maxmin_bench.c +++ b/teshsuite/surf/maxmin_bench/maxmin_bench.c @@ -11,25 +11,32 @@ #include "xbt/xbt_os_time.h" #include "xbt/sysdep.h" /* time manipulation for benchmarking */ +#define MYRANDMAX 1000 + #include #include +#include double date; +int64_t seedx= 0; + +static int myrand(void) { + seedx=seedx * 16807 % 2147483647; + return (int32_t) seedx%1000; +} -double float_random(double max); -double float_random(double max) +static 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) +static int int_random(int max) { - return (int) (((max * 1.0) * rand()) / (RAND_MAX + 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); @@ -37,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++) { @@ -48,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]= @@ -121,9 +127,9 @@ 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|perf]\n"); + printf("Syntax: [test|debug|perf]\n"); return -1; } @@ -143,16 +149,21 @@ int main(int argc, char **argv) //How many times? testcount=atoi(argv[2]); - + //Show me everything (debug or performance)! mode=0; if(argc>=4 && strcmp(argv[3],"test")==0) mode=1; - if(argc>=4 && strcmp(argv[3],"perf")==0) + if(argc>=4 && strcmp(argv[3],"debug")==0) mode=2; - + 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]; @@ -167,8 +178,10 @@ int main(int argc, char **argv) //nb_elem=200 xbt_init(&argc, argv); - + for(i=0;i