source: doc/papers/general/evaluation/bench.hpp @ 6a8208cb

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 6a8208cb was 79d4186, checked in by Aaron Moss <a3moss@…>, 6 years ago

Update evaluation code for paper

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