|
|
|
@ -9,6 +9,9 @@ double gasdev(long* idum, long* idum2, long* iy, long iv[NTAB]) {
|
|
|
|
|
/*returns a normally distributed deviate with 0 mean*/
|
|
|
|
|
/*and unit variance, using ran2(idum) as the source */
|
|
|
|
|
/*of uniform deviates */
|
|
|
|
|
double* used_ram_t0 = malloc(sizeof(double));
|
|
|
|
|
getVirtualMemUsed(used_ram_t0);
|
|
|
|
|
|
|
|
|
|
clock_t t = clock();
|
|
|
|
|
|
|
|
|
|
log_info("RESULT = in progress, idum = %f, idum2 = %f, iy = %f", *idum, *idum2, *iy);
|
|
|
|
@ -32,19 +35,14 @@ double gasdev(long* idum, long* idum2, long* iy, long iv[NTAB]) {
|
|
|
|
|
t = clock() - t;
|
|
|
|
|
double time_taken = ((double)t)/CLOCKS_PER_SEC; // calculate the elapsed time
|
|
|
|
|
|
|
|
|
|
double* total_ram = malloc(sizeof(double));
|
|
|
|
|
getTotalVirtualMem(total_ram);
|
|
|
|
|
|
|
|
|
|
double* used_ram = malloc(sizeof(double));
|
|
|
|
|
getVirtualMemUsed(used_ram);
|
|
|
|
|
double* used_ram_tf = malloc(sizeof(double));
|
|
|
|
|
getVirtualMemUsed(used_ram_tf);
|
|
|
|
|
|
|
|
|
|
log_info("TOTAL VIRTUAL MEM = %5.1f MB, USED VIRTUAL MEM = %5.1f MB, USED VIRTUAL MEM BY CURRENT PROCESS = %d MB",
|
|
|
|
|
*total_ram, *used_ram, getVirtualMemUsedByCurrentProcess());
|
|
|
|
|
log_info("RESULT = success, gset = %f, fac = %f, v1 = %f, ELAPSED = %f seconds, DIF USED VIRTUAL MEM = %5.1f MB", gset, fac, v1, time_taken, *used_ram_tf - *used_ram_t0);
|
|
|
|
|
|
|
|
|
|
free(total_ram);
|
|
|
|
|
free(used_ram);
|
|
|
|
|
free(used_ram_t0);
|
|
|
|
|
free(used_ram_tf);
|
|
|
|
|
|
|
|
|
|
log_info("RESULT = success, gset = %f, fac = %f, v1 = %f, ELAPSED = %f seconds", gset, fac, v1, time_taken);
|
|
|
|
|
return (v2 * fac);
|
|
|
|
|
} else {
|
|
|
|
|
iset = 0;
|
|
|
|
@ -52,19 +50,14 @@ double gasdev(long* idum, long* idum2, long* iy, long iv[NTAB]) {
|
|
|
|
|
t = clock() - t;
|
|
|
|
|
double time_taken = ((double)t)/CLOCKS_PER_SEC; // calculate the elapsed time
|
|
|
|
|
|
|
|
|
|
double* total_ram = malloc(sizeof(double));
|
|
|
|
|
getTotalVirtualMem(total_ram);
|
|
|
|
|
|
|
|
|
|
double* used_ram = malloc(sizeof(double));
|
|
|
|
|
getVirtualMemUsed(used_ram);
|
|
|
|
|
double* used_ram_tf = malloc(sizeof(double));
|
|
|
|
|
getVirtualMemUsed(used_ram_tf);
|
|
|
|
|
|
|
|
|
|
log_info("TOTAL VIRTUAL MEM = %5.1f MB, USED VIRTUAL MEM = %5.1f MB, USED VIRTUAL MEM BY CURRENT PROCESS = %d MB",
|
|
|
|
|
*total_ram, *used_ram, getVirtualMemUsedByCurrentProcess());
|
|
|
|
|
log_info("RESULT = success, gset = %f, ELAPSED = %f seconds, DIF USED VIRTUAL MEM = %5.1f MB", gset, time_taken, *used_ram_tf - *used_ram_t0);
|
|
|
|
|
|
|
|
|
|
free(total_ram);
|
|
|
|
|
free(used_ram);
|
|
|
|
|
free(used_ram_t0);
|
|
|
|
|
free(used_ram_tf);
|
|
|
|
|
|
|
|
|
|
log_info("RESULT = success, gset = %f, ELAPSED = %f seconds", gset, time_taken);
|
|
|
|
|
return gset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|