commit e84528359c071451a2fbe6fcc23bea6afc198f06 parent 25528786d802681149c02fb4f08cec79209fa50c Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu> Date: Sun, 5 Apr 2015 15:35:27 -0400 time execution Diffstat:
| M | tmain.c | | | 11 | ++++++++++- |
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tmain.c b/tmain.c @@ -1,8 +1,17 @@ #include <stdio.h> +#include <time.h> + extern long f(void); int main() { - printf("f() = %ld\n", f()); + clock_t t0; + long l; + + t0 = clock(); + l = f(); + t0 = clock() - t0; + printf("f() = %ld\n", l); + printf(" %.4f secs\n", (double)t0/CLOCKS_PER_SEC); return 0; }