source: doc/generic_types/evaluation/bench.h @ 122aecd

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 122aecd was 122aecd, checked in by Aaron Moss <a3moss@…>, 5 years ago

Expand benchmarks

  • Property mode set to 100644
File size: 420 bytes
Line 
1#include <stdio.h>
2#include <time.h>
3
4 // #define N 50000000
5 #define N 5
6
7
8long ms_between(clock_t start, clock_t end) {
9        return (end - start) / (CLOCKS_PER_SEC / 1000);
10}
11
12#define TIMED(name, code) { \
13        clock_t start, end; \
14        start = clock(); \
15        code \
16        end = clock(); \
17        printf("%s:\t%7ld ms\n", name, ms_between(start, end)); \
18}
19
20#define REPEAT_TIMED(name, code) TIMED( name, for (int i = 0; i < N; ++i) { code } )
Note: See TracBrowser for help on using the repository browser.