00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include "scalability.h"
00024
00025 #include "cputimer.h"
00026 #include "testsuite.h"
00027
00028 void
00029 test_scalability(double (*func)(unsigned), unsigned n, double threshold)
00030 {
00031 double time1;
00032
00033
00034 do {
00035 time1 = func(n);
00036 tout << "Test with " << n << " repetitions took " << time1 << " secs\n";
00037 unsigned n_new = n * 10;
00038 if (n_new < n)
00039 SKIP_TEST("Can't count enough repetitions to be able to time test");
00040 n = n_new;
00041 } while (time1 <= 0.001);
00042
00043 double time10 = func(n);
00044 tout << "Test with " << n << " repetitions took " << time10 << " secs\n";
00045
00046 TEST_REL(time10,<,time1 * threshold);
00047 }