source: doc/generic_types/evaluation/bench.h @ b276be5

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

Further updates to benchmarks (new C++ virtual benchmark still slightly broken)

  • Property mode set to 100644
File size: 438 bytes
Line 
1#pragma once
2
3#include <stdio.h>
4#include <time.h>
5
6 #define N 100000000
7 
8
9long ms_between(clock_t start, clock_t end) {
10        return (end - start) / (CLOCKS_PER_SEC / 1000);
11}
12
13#define TIMED(name, code) { \
14        volatile clock_t _start, _end; \
15        _start = clock(); \
16        code \
17        _end = clock(); \
18        printf("%s:\t%7ld ms\n", name, ms_between(_start, _end)); \
19}
20
21#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.