source: doc/generic_types/evaluation/bench.hpp @ 308880c

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 308880c was 3fb7f5e, checked in by Aaron Moss <a3moss@…>, 7 years ago

Update benchmarks, cleanup edits to the evaluation section

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