From 209a80bb669ae1c8d25a195b4d22cc1a1cfa1ddf Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sun, 5 Apr 2015 15:52:18 -0400 Subject: run multiple rounds for stable timing --- tmain.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tmain.c b/tmain.c index 0031fc2..79e1c24 100644 --- a/tmain.c +++ b/tmain.c @@ -1,16 +1,23 @@ #include #include +enum { NRounds = 150 }; + extern long f(void); int main() { - clock_t t0; - long l; + clock_t t0, tmin; + long i, l; - t0 = clock(); - l = f(); - t0 = clock() - t0; + tmin = 10 * CLOCKS_PER_SEC; + for (i=0; i