libqbe/tmain.c

25 lines
363 B
C
Raw Normal View History

2015-04-05 15:09:59 -04:00
#include <stdio.h>
2015-04-05 15:35:27 -04:00
#include <time.h>
2015-04-05 15:52:18 -04:00
enum { NRounds = 150 };
2015-04-05 15:09:59 -04:00
extern long f(void);
int main()
{
2015-04-05 15:52:18 -04:00
clock_t t0, tmin;
long i, l;
2015-04-05 15:35:27 -04:00
2015-04-05 15:52:18 -04:00
tmin = 10 * CLOCKS_PER_SEC;
for (i=0; i<NRounds; i++) {
t0 = clock();
l = f();
t0 = clock() - t0;
if (t0 < tmin)
tmin = t0;
}
2015-04-05 15:35:27 -04:00
printf("f() = %ld\n", l);
printf(" %.4f secs\n", (double)t0/CLOCKS_PER_SEC);
2015-04-05 15:09:59 -04:00
return 0;
}