source: doc/generic_types/evaluation/bench.h @ 3fb7f5e

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

Update benchmarks, cleanup edits to the evaluation section

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