#include "xbt/xbt_os_time.h"
#include "xbt/sysdep.h" /* time manipulation for benchmarking */
+#define MYRANDMAX 1000
+
#include <stdlib.h>
#include <stdio.h>
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);
int *used = xbt_new0(int, nb_cnst);
int i, j, k,l;
int concurrency_share;
+
+ char buf[1000];
Sys = lmm_system_new(1);
}
}
- 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;
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);
return -2;
}
+
//How many times?
testcount=atoi(argv[2]);
xbt_init(&argc, argv);
for(i=0;i<testcount;i++){
+ seedx=i+1;
+ printf("Starting %i: (%i)\n",i,myrand()%1000);
test(nb_cnst, nb_var, nb_elem, pw_base_limit, pw_max_limit, rate_no_limit,max_share,mode);
acc_date+=date;
acc_date2+=date*date;