X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0f3d85e5d91158b55c5dcd30d0400059574e4425..e3ff580889f5d85e5bdb7a42bad335184bbce0ed:/teshsuite/smpi/mpich3-test/perf/timer.c diff --git a/teshsuite/smpi/mpich3-test/perf/timer.c b/teshsuite/smpi/mpich3-test/perf/timer.c index 1a778c4493..4a77d18b34 100644 --- a/teshsuite/smpi/mpich3-test/perf/timer.c +++ b/teshsuite/smpi/mpich3-test/perf/timer.c @@ -4,7 +4,7 @@ * See COPYRIGHT in top-level directory. */ -/* +/* * Check that the timer produces monotone nondecreasing times and that * the Tick is reasonable */ @@ -17,51 +17,53 @@ static int verbose = 0; #define MAX_TIMER_TEST 5000 -int main(int argc, char* argv[]) +int main(int argc, char *argv[]) { double t1[MAX_TIMER_TEST], tick[MAX_TIMER_TEST], tickval; double minDiff, maxDiff, diff; int i, nZeros = 0; int errs = 0; - MTest_Init(&argc,&argv); + MTest_Init(&argc, &argv); - for (i=0; i maxDiff) maxDiff = diff; + nZeros = 0; + for (i = 1; i < MAX_TIMER_TEST; i++) { + diff = t1[i] - t1[i - 1]; + if (diff == 0.0) + nZeros++; + else if (diff < minDiff) + minDiff = diff; + if (diff > maxDiff) + maxDiff = diff; } /* Are the time diff values and tick values consistent */ if (verbose) { - printf( "Tick = %e, timer range = [%e,%e]\n", tickval, minDiff, - maxDiff ); - if (nZeros) printf( "Wtime difference was 0 %d times\n", nZeros ); - } + printf("Tick = %e, timer range = [%e,%e]\n", tickval, minDiff, maxDiff); + if (nZeros) + printf("Wtime difference was 0 %d times\n", nZeros); + } MTest_Finalize(errs); MPI_Finalize();